hey guys can u help me to solve this program
have to do 4 function , call the following functions by passing the array:
(i) A function to input all information.
(ii) A function to calculate the average score for each student and the average score for the class. Find the student with highest and lowest average score.
(iii) A function to find students who score lower than 50 marks.
(iv) A function to display all the information. The information should be displayed in a proper format.
#include <iostream>
using namespace std;
const int NUM_NAMES =5; //how many occurances
const int NAMESIZE = 11; //how long names can be, 10 letters
const int NUM_TESTS = 3; //how many tests
char name[NUM_NAMES][NAMESIZE]; //two-dimensional name array
char grade[5]; //grade letter for each student array
double testscore[NUM_NAMES][NUM_TESTS]; //test score for each student
double average[5]; //average for each student array
//function prototype
void calcdata(int, double[][NUM_TESTS]);
//start of main
int main()
{
cout << "Enter the student's name. \n";
for (int count = 0; count < NUM_NAMES; count++)
{
cout << "Student " << (count +1) <<": ";
cin >> name[count];
}
for (int student = 0; student < NUM_NAMES; student++)
{
for (int testnum = 0; testnum < NUM_TESTS; testnum++)
{
cout << "what is the test score for " << name[student];
cout << " for test:" << testnum+1<< endl;
cin >> testscore[student][testnum];
while (testscore[student][testnum] < 0 || testscore[student][testnum] > 100)
{
cout << "Please enter a number between 0 and 100" << endl;
cin >> testscore[student][testnum];
cout << endl;
}
}
}
//call to function calcdata
calcdata(NUM_NAMES, testscore);
system("Pause");
return 0;
} //end of main
void calcdata(int NUM_NAMES, double testscore[][NUM_TESTS])
{
double total;
//get each students average score
for (int row = 0; row < NUM_NAMES; row++)
{
//set the accumulator.
total = 0;
//sum a row
for (int col = 0; col < NUM_TESTS; col++)
total += testscore[row][col];
//get the average
average[row] = total / NUM_TESTS;
//get the grade
if (average[row] < 60)
grade[row] = 'F';
else if (average[row] < 70)
grade[row] = 'D';
else if (average[row] < 80)
grade[row] = 'C';
else if (average[row] < 90)
grade[row] = 'B';
else if (average[row] < 100)
grade[row] = 'A';
}
for (int i = 0; i < 5; i++)
cout << "Student: " << name[i]
<<" average: " << average[i]
<<" grade: " << grade[i]
<< endl;
}