void Movie::test()
{
int year;
int time = 0;
double gross;
int sumTime = 0;
while (inMovie >> year >> time >> gross)
{
string name;
if (getline(inMovie >> ws, name))
{
cout << (sumTime += time) << "\n\n";
}
}
}
I figured out that my function is adding 116+0, then 116+169, then 116+169+141, and so on, but I can't figure out how to make the program read the sum of ALL of the numbers at one time. All I want to display is 633. Any help is greatly appreciated, thank you.