Answer to Question #298784 in C++ for Tabie

Question #298784

Write a program to calculate the sum and average of your various courses and use it to determine your grading point



If grade is equal to or greater than 70 your grade is A



If grade equivalent or greater than 60 your grade is B



If grade equivalent or greater than 50 your grade is C



If grade equivalent or greater than 45 your grade is D



If grade equivalent or greater than 40 your grade is E



Anything below your grade is F.

1
Expert's answer
2022-02-17T02:14:03-0500
#include<iostream>

using namespace std;

int main()
{
	int numCourses=0;
	double sum=0;
	double grade;
	cout<<"Please, enter grading points of various courses (-1 - exit): ";
	do
	{
		cin>>grade;
		if(grade>=0)
		{
			sum+=grade;	
			numCourses++;
		}
	}while(grade>=0);
	
	double averageGrd=sum/numCourses;
	cout<<"Your grade is ";
	if(averageGrd>=70)
		cout<<"A";
	else if(averageGrd>=60)
		cout<<"B";
	else if(averageGrd>=50)
		cout<<"C";
	else if(averageGrd>=45)
		cout<<"D";
	else if(averageGrd>=40)
		cout<<"E";
	else 
		cout<<"F";
	
}

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