Quote (silvermace @ Oct 11 2013 07:15pm)
you can't add a file stream to an integer (sum += num_list).
you should read in the next int, since c++ can't read integers from a file directly, you have one of two options.
Depending on how the file is structured, you could read next line and then change the string to an int.
Else, keep getting chars till you hit a space or carriage return, and then cast the string of chars into an int.
here is my new while loop:
while ( !num_list.eof())
{
count=0;
while (count <= 50)
{
num_list >> number;
sum += number;
count++;
}
}
now when I run it, a blank black box comes up(nothing happens)
This post was edited by Si7c on Oct 11 2013 05:23pm