[user02@FC4 Lesson08]$ cat -n showgrad.cpp
1 #include <iostream>
2 using namespace std;
3
4 int main()
5 {
6 int test_score;
7
8 cout << "Type in your test score and press Enter: ";
9 cin >> test_score;
10
11 if (test_score >= 90)
12 cout << "You got an A!" << endl;
13 else if (test_score >= 80)
14 cout << "You got a B!" << endl;
15 else if (test_score >= 70)
16 cout << "You got a C" << endl;
17 else if (test_score >= 60)
18 cout << "Your grade was a D" << endl;
19 else
20 cout << "You failed the test" << endl;
21
22 return 0;
23 }
[user02@FC4 Lesson08]$ g++ -o showgrad showgrad.cpp[user02@FC4 Lesson08]$ ./showgrad
Type in your test score and press Enter: 97
You got an A!
[user02@FC4 Lesson08]$ ./showgrad
Type in your test score and press Enter: 82
You got a B!
[user02@FC4 Lesson08]$ ./showgrad
Type in your test score and press Enter: 78
You got a C
[user02@FC4 Lesson08]$ ./showgrad
Type in your test score and press Enter: 64
Your grade was a D
[user02@FC4 Lesson08]$ ./showgrad
Type in your test score and press Enter: 56
You failed the test
lesson_8_showgrad.cpp, Rev. 7, Last changed on 2005-08-10 03:33, 289 page hits