[user02@FC4 Lesson08]$ cat -n cmp_else.cpp
1 #include <iostream>
2 using namespace std;
3
4 int main()
5 {
6 int test_score = 65;
7
8 if (test_score >= 90)
9 {
10 cout << "Congratulations, you got an A!" << endl;
11 cout << "Your test score was " << test_score << endl;
12 }
13 else
14 {
15 cout << "You should have worked harder!" << endl;
16 cout << "You missed " << 100 - test_score << " points " << endl;
17 }
18
19 return 0;
20 }
[user02@FC4 Lesson08]$ g++ -o cmp_else cmp_else.cpp[user02@FC4 Lesson08]$ ./cmp_else
You should have worked harder!
You missed 35 points
lesson_8_cmp_else.cpp, Rev. 1, Last changed on 2005-08-10 03:26, 309 page hits