Reading numbers from a file
I had changed my while loop to:
while (inFile >> value)
Do I still need inFile >> value;
outside of my loop?
now I'm getting crazy large numbers in my output. |
Your counts / totals are not initialised. They contain garbage. Set them to zero at the start.
Do I still need inFile >> value; outside of my loop? |
No. If you have that as well, it will read and discard the first value from the file.
Oh, right. Duh. I had initialized them in the beginning and I don't know why I had gotten rid of them. Thanks.
Topic archived. No new replies allowed.