forked from sinairv/Cpp-Tutorial-Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProg.cpp
34 lines (31 loc) · 831 Bytes
/
Prog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// In an if statement it is not necessary for the expression to be a boolean one.
// If a value such as an integer is given to it, it checks if the value is zero or not.
// If it is zero it plays the roll FALSE.
// If it is not zero (even if it is negative) it plays the roll of TRUE.
// As an example refer to line : 27.
#include <iostream>
using namespace std;
int main ()
{
int grade;
cout << "Enter your grade : ";
cin >> grade;
if (grade >= 90)
cout << "A\n";
else if (grade >= 80)
cout << "B\n";
else if (grade >= 70)
cout << "C\n";
else if (grade >= 60)
cout << "D\n";
else
{
cout << "F : Fail.\n";
cout << "You must take this course again.\n";
}
if(grade)
cout << "Your grade wasn't zero." << endl;
else
cout << "Your grade was zero." << endl;
return 0;
}