The trouble is you think you have time. Your success depends on how you utilize your time.

C++ Program which will takes the marks of 5 subjects and print the percentage and grade.

Write a C++ Program which will take the marks of five subjects as input and take the total marks as well and print the percentage and grade.

#include<iostream>
#include<conio.h>


using namespace std;
int main()
{
cout<<"www.moznum.blogspot.com"<<endl<<endl;

     float x=0,eng=0,pf=0,be=0,ict=0,isl=0,aggregate=0,total=0,obtained=0,percent=0;

 
      cout<<endl<< "Enter the Total marks out of you've otained marks: ";
      cin>>total;
 cout<<endl<<"Enter marks of 1st Subject: ";
      cin>>eng;
      cout<<"Enter marks of 2nd Subject: ";
      cin>>pf;
      cout<<"Enter marks of 3rd Subject: ";
      cin>>be;
      cout<<"Enter marks of 4th Subject: ";
      cin>>ict;
      cout<<"Enter marks of 5th Subject: ";
      cin>>isl;
      obtained=eng+pf+ict+isl+be;
   
      percent= (obtained / total)*100;
   
 cout<<"Percentage is: "<<percent<<"%"<<endl;
   
 if(percent > 89 && percent < 100)
      cout<<"OUTSTANDING A+"<<endl;
      else if(percent>79&&percent<90)
      cout<<"Excellent A"<<endl;
      else if (percent>69&&percent<80)
      cout<<"Good B"<<endl;
     else if(percent>59&&percent<70)
      cout<<"Fair C"<<endl;
      else if(percent>49&&percent<60)
      cout<<"Satisfactory D"<<endl;
      else if(percent<50)
      cout<<"Fail F"<<endl;
     
      getche();
      return 0;
}

     





5 comments:

  1. Hi to all i have to used function i have written a programme to accept marks but how to write code ina same programme to show the grades in c++

    ReplyDelete
  2. This question confuses me

    Suppose we want to compile a student academic report for a high school learner in grade 12 (matric). 
    A matric learner is enrolled for 6 study units (subjects), namely: English, Mathematics, Life Orientation, 
    History, Computer literacy, Geography. The learner has to pass at least four subjects, including English, 
    to complete grade 12. The subject pass mark is 50%. 
    Write a program that prompts the learner to key in their marks for each subject.  The program should 
    include the following functions: 
    a. A function studentDetails, that prompts the learner to key in their personal details 
    name,surname,  and schoolName.                       (3)
    b. A function getMarks, that prompts the learner to key in a mark for each of the six subjects, and 
    validate the marks. Do not accept marks lower than 0 or higher than 100.          (3)
    c. A function calcAverageYearMark, to calculate and display the average of the 6 Subjects. This 
    function should be called just once by main, and should be passed the 6 Subject marks.           (6)
    d. A function minMax, to find and return the lowest  and the highest of the 6 subject marks 
    passed to it as the subject with the lowest mark;

    ReplyDelete
  3. tbrevfrbghnrjmymjnhbgvfcwdfvvgbhnjynu5ny4tr3vtvbny5y4bte

    ReplyDelete
  4. 6mun5ybtvtbnhjm6ik,7o.8n65yb4tv3rtb4yn

    ReplyDelete