cout << "What is the cost of each box? ";
cin >> cost;
cout << endl;
while (!inFile.eof())
{
inFile >> name >> boxes;
totalbox =boxes + boxes;
numvolunteer++;
cout << name << " " << boxes << endl;
}
cout << "Name: " << name << endl;
cout << "The number of boxes sold is: " << totalbox << endl;
cout << "The cost of each box sold is: " << cost << endl;
cout << "The number of volunteers is: " << numvolunteer << endl;
system ("Pause");
return 0;
}
When I do the output, I get:
What is the cost of each box? 1.25
Sara 120
Lisa 128
Cindy 359
Nicole 267
Blair 165
Abby 290
Amy 190
Megan 450
Elizabeth 280
Meredith 290
Leslie 430
Chelsea 378
Name: Chelsea
The number of boxes sold is: 756
The cost of each box sold is: 1.25
The number of volunteers is: 4284934
Press any key to continue . . .
______
Can you guys tell me where I am going wrong? I can even give the format and text in the Data.txt file below:
Sara 120
Lisa 128
Cindy 359
Nicole 267
Blair 165
Abby 290
Amy 190
Megan 450
Elizabeth 280
Meredith 290
Leslie 430
Chelsea 378