Saturday, July 29, 2017

Write a program that determines a student’s grade. The program will read three types of scores (quiz, mid-term, and final scores) and determine the grade based on the below rules.

/*

#Rules

-if the average score =90% =>grade=A
-if the average score >= 70% and <90% => grade=B
-if the average score>=50% and <70% =>grade=C
-if the average score<50% =>grade=F

*/



/*
For more exercises and lessons, visit http://shegertech.blogspot.com/
*/

#include <cstdlib>
#include <iostream>
#include<iomanip>

using namespace std;

int main(int argc, char *argv[])
{
   float x;
   float y;
   float z;
   float avg;
   cout<<"Enter 3 score(quiz, mid-term, and final) vales separated by space:";
   cin>>x>>y>>z;
   avg=(x+y+z)/3;
     
   if(avg>=90)cout<<"Grade A";
   else if((avg>=70) && (avg<90)) cout<<"Grade B";
   else if((avg>=50) && (avg<70))cout<<"Grade C";
   else if(avg<50) cout<<"Grade F";
   else cout<<"Invalid";
 
   cout<<"\n";
   system("PAUSE");
   return EXIT_SUCCESS;
}

Share: