Answer to Question #306230 in C++ for Harse

Question #306230

Write a c++ program to compute the results of five HND 1 students taking all the first semester courses displaying their number,course title and grades.

1
Expert's answer
2022-03-05T06:48:07-0500
using namespace std;


#define NO_OF_STUDENTS	3
#define NO_OF_SUBJECTS	5


int main()
{
	int Marks[NO_OF_STUDENTS][NO_OF_SUBJECTS+1];
	int r,c,a,b;
	
	for(r=0;r<NO_OF_STUDENTS;r++)
	{
		for(c=0;c<NO_OF_SUBJECTS+1;c++)
		{
			Marks[r][c]] = 0;
		}
	}


	for(r=0;r<NO_OF_STUDENTS;r++)
	{
		for(c=0;c<NO_OF_SUBJECTS;c++)
		{
			cout<<"\nEnter Student-"<<r+1<<": Subject-"<<c+1<<" Marks: "; cin>>Marks[r][c];
			Marks[r][c] = Marks[r][c]+Marks[r][c];
		}
	}
	for(r=0;r<NO_OF_STUDENTS;r++)
	{
		Marks[r][NO_OF_SUBJECTS] = Marks[r][NO_OF_SUBJECTS]/NO_OF_SUBJECTS;
		if(Marks[r][NO_OF_SUBJECTS]<50) cout<<"\n\tStudent-"<<r+1<<" Grade-D";
		if(Marks[r][NO_OF_SUBJECTS]>=50 && Marks[r][NO_OF_SUBJECTS]<60) cout<<"\n\tStudent-"<<r+1<<" Grade-C";
		if(Marks[r][NO_OF_SUBJECTS]>=60 && Marks[r][NO_OF_SUBJECTS]<80) cout<<"\n\tStudent-"<<r+1<<" Grade-B";
		if(Marks[r][NO_OF_SUBJECTS]>=50) cout<<"\n\tStudent-"<<r+1<<" Grade-A";
	}
	return(0);	
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog