Letter Equivalent of your Grade in C++

Letter Equivalent of your Grade in C++

Version
Download 11
Total Views 0
Stock
File Size 1.25 KB
File Type zip
Create Date May 5, 2016
Last Updated May 5, 2016
Download

Letter Equivalent of your Grade in C++
The program will ask you to enter your grade, the program will then evaluate what is the equivalent letter of your grade using the if else if statement.
Grade above 90 is A
Grades from 80 to 89 is B
Grades from 70 to 79 is C
Grades from 60 to 69 is D
Grades below 60 is F
Happy Programming

Source code:

#include < iostream >
using namespace std;

int main()
{
    double mygrade;
    cout << "Enter your grade: " << endl;
    cin>>mygrade;

    if (mygrade >= 90)
    {
        cout <<"You grade: "<< mygrade << " is A" << endl;
    }
    else if (mygrade >= 80 &&  mygrade < 90)
    {
        cout <<"You grade: "<< mygrade << " is B" << endl;
    }
    else if (mygrade >= 70 &&  mygrade < 80)
    {
        cout <<"You grade: "<< mygrade << " is C" << endl;
    }
    else if (mygrade >= 60 &&  mygrade < 70)
    {
        cout <<"You grade: "<< mygrade << " is D" << endl;
    }
    else
    {
        cout <<"You grade: "<< mygrade << " is F" << endl;
    }

    return 0;
}

Comments

comments

Leave a Reply

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

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.