C++ Program To Find Grade in Subjects

This is a simple C++ program for beginners to find the grade is a subject. This is a beginning level program and we only did it with IF else condition to understand the condition statement.  

Source Code

#include<iostream>
#include<conio.h>
#include<stdio.h>
using namespace std;

int main()
{
  int marks;
  char ch;
  cout<<endl<<endl<<"*********** Find Grades ***********"<<endl<<endl;
  do{
  cout<<"Enter marks : ";   
  cin>>marks;       // Here Is Enter your Marks
  if (marks>=80)      // Check if your Marks is Greater or equal than 80 than u got A
  {
  cout<<"A";
  }
  else if(marks>=70)     // Check if your Marks is Greater or equal than 70 than u got B
  {
  cout<<"B";
  }
  else if(marks>=60)     // Check if your Marks is Greater or equal than 60 than u got C
  {
  cout<<"C";
  }
  else if(marks>=50)     // Check if your Marks is Greater or equal than 50 than u got D
  {
  cout<<"D";
  }
  else        // Check if your Marks is less or equal than 49 than u fail
  {
  cout<<"Fail";
  }
  cout<<endl<<endl<<"Do you Want Continue : (Y/N)"<<endl<<endl; // If you want to exist Press N
  cin>>ch;
  cout<<endl;
  }while(ch=='y');
return 0;
}

Output of the Program


Grades in Subjects

Share on Google Plus

About Asad

Asad Niazi is Software Engineer , Programmer, Web Developer and a young mentor of BloggersTown and PProgramming. Asad Love to writes about Technology, Programming, Blogging and make money online.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment