| insane24illusions (36) | |||
|
Hello. I failed my C++ class two semesters ago and I am retaking it. I am doing really well completing all my programming projects on time. I created this program last year in which it reads numbers from a file (of type double) and outputs its average. It runs great to my surprise. I just wanna know if anyone can explain my while loop? I just don't quite understand my Boolean expression. Please and Thank you. No Rush Its already submitted I just wished to be "schooled" lol.
| |||
|
Last edited on
|
|||
| Angeljruiz (167) | |
| It keeps looping until its the end of the file. | |
|
|
|
| insane24illusions (36) | |
|
So as long as the list has a number it will keep looping? that's the description of (list_num >> number)So that means when the last number is read the loop stoops?????? | |
|
Last edited on
|
|
| insane24illusions (36) | |
| I know I'm over analyzing Sorry but it has been bugging me. | |
|
|
|
| insane24illusions (36) | |
| I think I understand Thank you. | |
|
|
|
| Angeljruiz (167) | |
| Yeah you got it :P Sorry for the late reply | |
|
|
|
| insane24illusions (36) | |
| Its ok I stay on this lol But thanks :) | |
|
Last edited on
|
|
| SamuelAdams (185) | |
|
If the next line in the file is not a double or EOF it keeps going. If the next line is a new line it keeps going which surprised me. I guess it ignores the new line \n char. So if it hits a Letter it stops. It also surprised me that if the line is 10+20-10 , it still works and counts the last number as a negative, but 10+20/10 makes it stop at the /. | |
|
|
|