I have looked through the forums and I did not find a topic with a program question similar to mine. I am having problems with setting up a program. The guidelines are:
The first line will contain the number of test scores for each student followed
by the number of students.
Each following line will contain a student record consisting of the student's
name (last name only, no space) followed by his test scores. No scores will be
missing.
Your program should calculate and report the average for each
student with that student's lowest test score being dropped.
I don't have much written, so far, but if I could get a little better idea of where I am going that would be much appreciated.
ifstream inData; // Opens text file
float stcount; // Student count
float testscore; // Student's test score
string studentname; // Student's last name read in
float sum = 0;
float average = 0;
int howmanyscores; // How many scores will be read in
int numnames; // How many student names will be read in
// Open text file
inData.open ( "lab6data.text" );
// Extract the number of last names and how many test scores being read
inData >> howmanyscores >> numnames >> endl;
// Initialize student count
stcount = 0
// Read in first student's name and test scores
inData >> studentname;
// Begin loop
while ( inData )
stcount ++;
inData >> studentname;
// Read and sum each student's test scores
// Average each student's test scores
if (counter != 0 )
average = sum / stcount;
// Output the student's last name and their average test score in columns
cout << " Last name Average Test Score " << endl;
I don't know about arrays or anything like that yet so I can't use that. I do believe this needs to be a nested loop type of program. I am not really sure how to make that work as well as having the program drop the lowest test score. Thank you in advance for any help.
It is. I am not expecting an entire program written, just how to start working this program. My professor doesn't explain the material in a way I understand, so I am usually on my own for these programs.
Wow!!! Thank you!! I wasn'y expecting this much. I guess first thing in the morning I will be putting that to use and we will see from there. Thank you cire.