Machine Problem

Write a program that will ask the user to give a grade and then the program will compute the average grade using for loop statement in C++ programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website, kindly contact me also at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.

Program Listing

/* average_grade_for_loop.cpp
   Jake Rodriguez Pomperada,MAED-IT,MIT
   www.jakerpomperada.com www.jakerpomperada.blogspot.com
   jakerpomperada@gmail.com
   Bacolod City, Negros Occidental Philippines
*/

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
	
	int NumGrades=0;
	double grades=0.00;
	double total=0.00,GradeAv=0.00;
	
	cout <<"\n\n";
    cout <<"\tAverage Grade Solver Using For Loop in C++";
    cout <<"\n\n";
	for (NumGrades = 0;; NumGrades++)
	{
		cout << "\tEnter the Grade No. " << (NumGrades+1) 
		<< ".  (Press -1 To Stop ) : ";
		cin >> grades;
		
		total += grades;
		
	
		
		if (grades == -1) {
			GradeAv = ceil((total / NumGrades));
			cout << "\n\n\tThe average of Grade is " << 
		     GradeAv<< ".";		
			break;
		}
			
     }
      cout <<"\n\n";
	  cout <<"\tEnd of Program";
	  cout <<"\n";
	}

Leave a Reply

Your email address will not be published. Required fields are marked *