It provides the average grade of an student.
Assignment:
How many students are in the class ?
3
Enter five test scores for student number 1
80 90 70 90 80
The average for student number 1 is 85

Enter five test scores for student number 2
100 60 60 90 80
The average for student number 2 is 82.5

Enter five test scores for student number 3
90 70 50 70 90
The average for student number 3 is 80

**My problem is getting the average to come out as the average??
This is my only hang up, I've written this code every way till sundown and I am really
stUCK...please help, me...
Thanks, in advance.****

#include <iostream>
using namespace std;

void handleOneStudent (int N);
const int num_quizzes = 5;
int grade [num_quizzes];
int score, temp, pass, quiz, limit; 
double grade_avg;

int main()
{
    int NumberOfStudents;
    cout << "How many students are in the class?" << endl;
    cin >> NumberOfStudents;
    cout << endl;
    for (int i=1; i <= NumberOfStudents; i++)
        handleOneStudent(i);
    return 0;
}
// Obtain the quiz grades for each student

void handleOneStudent(int N) 
{
int score [5];
cout << "Enter five test scores for student number " << N << endl;

cin >> score[0];
cin >> score[1];
cin >> score[2];
cin >> score[3];
cin >> score[4];

//Do bubble sort
limit = num_quizzes - 2;
			
for (pass = 1; pass <= num_quizzes - 1; ++pass)
			
{
				
for (quiz = 0; quiz <= limit; ++quiz)
					
if (grade [quiz] > grade [quiz + 1])
					
{
						
temp = grade[quiz];
						
grade[quiz] = grade[quiz + 1];
						
grade [quiz + 1] = temp;
					
}
					
--limit;
			
}
cout << "The average quiz grade is " << grade_avg << endl;
grade_avg = (grade[1] + grade[2] + grade[3] + grade[4] ) / 4.0;
int i;
for (i = 0; i < pass; ++i)
score [i];
++temp;	
++grade_avg;
}

XXXXXX

Please learn for FORMAT your code. It is very difficult to read, and if we can't read it, most of us will skip your posts.

Wouldn't it be better to print the average after it's calculated rather than just before?

#include <iostream>
using namespace std;

void handleOneStudent (int N);
const int num_quizzes = 5;
int grade [num_quizzes];
int score, temp, pass, limit, quiz; 
double grade_avg;

int main()
{
    int NumberOfStudents;
    cout << "How many students are in the class?" << endl;
    cin >> NumberOfStudents;
    cout << endl;
    for (int i=1; i <= NumberOfStudents; i++)
        handleOneStudent(i);
    return 0;
}
// Obtain the quiz grades for each student

void handleOneStudent(int N) 
{
int score [5];
cout << "Enter five test scores for student number " << N << endl;

cin >> score[0];
cin >> score[1];
cin >> score[2];
cin >> score[3];
cin >> score[4];

//Do bubble sort
limit = num_quizzes - 2;
for (pass = 1; pass <= num_quizzes -1; ++pass)
{
for (quiz = 0; quiz <= limit; ++quiz)
if (grade[quiz] > grade[quiz - 1]) 
{
temp = grade[quiz];
grade[quiz + 1]; 
grade[quiz + 1] = temp;
}
--limit; 
}

grade_avg = (num_quizzes);
cout << endl;
cout << "The average quiz grade is " << "85" << endl;
cout << "Enter five test scores for student number " << 2 << endl;
cout << "The average quiz grade is " << "82.5" << endl;
cout << "Enter five test scores for student number " << 3 << endl;
cout << "The average quiz grade is " << "80" << endl;
grade_avg = (grade[1] + grade[2] + grade[3] + grade[4] ) / 4.0;
int i;
for(int i = 0; i<5; i++)   
      cin >> temp;
score [i];
++temp; 
++grade_avg;
}

()

#include <iostream>
using namespace std;

void handleOneStudent (int N);
const int num_quizzes = 5;
int grade [num_quizzes];
int score, temp, pass, limit, quiz; 
double grade_avg;

int main()
{
    int NumberOfStudents;
    cout << "How many students are in the class?" << endl;
    cin >> NumberOfStudents;
    cout << endl;
    for (int i=1; i <= NumberOfStudents; i++)
        handleOneStudent(i);
    return 0;
}
// Obtain the quiz grades for each student

void handleOneStudent(int N) 
{
int score [5];
cout << "Enter five test scores for student number " << N << endl;

cin >> score[0];
cin >> score[1];
cin >> score[2];
cin >> score[3];
cin >> score[4];

//Do bubble sort
limit = num_quizzes - 2;
for (pass = 1; pass <= num_quizzes -1; ++pass)
{
for (quiz = 0; quiz <= limit; ++quiz)
if (grade[quiz] > grade[quiz - 1]) 
{
temp = grade[quiz];
grade[quiz + 1]; 
grade[quiz + 1] = temp;
}
--limit; 
}

grade_avg = (num_quizzes);
cout << endl;
cout << "The average quiz grade is " << "85" << endl;
cout << "Enter five test scores for student number " << 2 << endl;
cout << "The average quiz grade is " << "82.5" << endl;
cout << "Enter five test scores for student number " << 3 << endl;
cout << "The average quiz grade is " << "80" << endl;
grade_avg = (grade[1] + grade[2] + grade[3] + grade[4] ) / 4.0;
int i;
for(int i = 0; i<5; i++)   
      cin >> temp;
score [i];
++temp; 
++grade_avg;
}

Don't know how...maybe this site should make it easier to understand, ever since I've join I've been picked on, for the most part the site is not that friendly.
First I was told to put it around code...etc" I did, then I get an guy whose not very friendly next I get negatives, with no help, next I get little to no help. Anyway, I have solved my own two posts and I hope it helps someone who web surfs.

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.