c++ - How does while input work? -
c++ - How does while input work? -
how does
while(cin >> variable) actually work? status loop until there no input or new input every time.
you @ first read values of value1, value2, value3
inputfile >> value1; inputfile >> value2; inputfile >> value3; and overwrite them in loop statement
while (inputfile >> value1 >> value2 >> value3){ the same valid read operations in end of loop
inputfile >> value1; inputfile >> value2; inputfile >> value3; } remove these statements before loop , in end of loop.
also check whether 3 numbers form valid tringle plenty check each 2 numbers greater 3rd number.
c++ file-io
Comments
Post a Comment