Question: #include using namespace std; double average(int grade[], int a) { int sum=0, b; for(b=0; b

#include

using namespace std;

double average(int grade[], int a)

{

int sum=0, b;

for(b=0; b

{

sum=sum+grade[b];

}

return (sum/a);

}

int highest(int grade[], int a)

{

int grt=grade[0], i;

for(i=0; i

{

if(grt

grt=grade[i];

}

return grt;

}

void pass(int grade[], char name[], int a, double ave)

{

cout<<"Students who pass are : "<

for(int k=0; k

{

if(grade[k]>ave)

cout<

}

}

int main()

{

char name[]={0};

int grade[]={0}, a=0, sum=0, l=0, size=0;

cout<<"Enter 00 to stop entering values"<

cout<<"Enter initial and grade : "<

while(1)

{

cin>>name[a];" ";

if(name[a]=='0')

break;

cin>>grade[a];

a++;

}

int high=highest(grade, a);

double ave=average(grade, a);

cout<<"Highest grade is "<

cout<

pass(grade, name, a, ave);

return 0;

}

//This is my code to find the largest and average of test grades entered. I also have to output the initials of the students whose grades are above average. Why is the program not outputting those initials and how do i fix it?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!