I'm trying to figure out how to do this program. A program is required to print and read a series of exam scores for students enrolled in a math class. The class average is to be computed and printed at the end of the report. Score can range form 0 - 100. The last record contains a blank name and score of 999 and is to not be included in the calculations.
-a do while structure to control the reading of exam scores until it reaches a score of 999
- an accumulator for total score
- an accumulator for total students

This is what I have so far:

#include <iostream>
#include <iomanip>
#include <string>

using namespace std;

int main()
	string name;
	int score;
	int average;
	int total_score;
	int total_students;
	int temp_one;
	int temp_two;

	cout << "Please enter students name and test score 0 - 100 with a space in     between." << endl;
	temp_one = total_score;
	temp_two = total_students;
	total_score = 0;
	total_students = 0;

		cin >> name >> score;

	while (score < 999);

	cout << name << score << endl;
	cout << "The class average is: " << average << endl;

It seems that you have one score, and you keep inputting to it.
I would suggest that you make a list of somekind, and input them into that. The names can be done the same way.
Then loop through, adding each students score to an int. when you're done, divide by the number of students, and print it. You should be done at that point.
See this page for more about vectors (a kind of list, very helpful. Though it is complicated).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.