- Version
- Download 15
- File Size 1.31 KB
- File Count 1
- Create Date April 27, 2016
- Last Updated April 27, 2016
If Else Statement in C++
If Else Statement in C++
Sample program that demonstrate if else statement in c++. The program will ask to enter a grade, if your grade is greater than or equal to 75 then you have a passing grade, grade less than 75 means failure.
Source code:
#include 
using namespace std;
int main()
{
    double mygrade;
    cout << "Enter your grade: " <> mygrade;
    if (mygrade >= 75 || mygrade <= 100)
    {
        cout << "You passed!, Congratulations" << endl;
    }
    else
    {
        cout << "Sorry you failed!, study hard next time" << endl;
    }
    return 0;
}
        
 
							 
							