This is what i have so far. Basically I need it to read in names and numbers from a file and output them. Then it needs to calculate the average for each person's score and give them a letter grade. Finally it needs to take all of the averages and calculate a class average.
using namespace std;
int counter; //While statement counter
int testScore; //Test score from file
string studentName; //Student Name
cout << "Please enter the filename to retrieve scores from: ";
cout << "File failed to open";
inFile >> numberOfTests;
inFile >> studentName;
cout << studentName;
studentTestTotal = 0;
studentAverage = 0;
while (counter <= numberOfTests)
inFile >> testScore;
cout << testScore;
studentTestTotal = studentTestTotal + testScore;
cout << endl;
1) I do not reset the counter at all... Yet it compiles and works perfectly. If i reset the counter it doesn't.... WHY!?
2) when i use inFile to input the names and scores... it puts them on a separate line. How can i get them to go on one line.
3) if i add this line
the program once again does not work. It is driving me crazy help is greatly appreciated
studentAverage = studentTestTotal / numberOfTests;