Answer to Question #327845 in C++ for fiona

Question #327845

1. Create a C++ program that let the user input his/here grade on the following subjects: Programming, Web Application, Oral Communication, Multimedia and Physics and calculate the average. 


Note : the program must also display/output the subjects with grades from the user and the average. 



1
Expert's answer
2022-04-12T13:26:24-0400
#include<iostream>
#include<string>


using namespace std;


int main()
{
	string arr[5] = { "Programming", "Web Application", "Oral Communication", "Multimedia", "Physics" };
	char ch;
	float sum = 0;
	float arrgrd[5];
	do
	{
		for (int i = 0; i < 5; i++)
		{
			cout << "Enter a grade for " << arr[i] << ": ";
			cin >> arrgrd[i];
			sum+= arrgrd[i];
		}
		for (int i = 0; i < 5; i++)
		{
			cout << "The grade for " << arr[i] << " is " << arrgrd[i] << endl;
		}
		cout << "The average is " << sum / 5;
		cout << "\nDo you want to continue? [Y/N]: ";
		cin >> ch;
		sum = 0;
	} while (ch == 'Y');
}	

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
APPROVED BY CLIENTS