lesson 8 cmp else cpp
[[lesson_8_cmp_else_cpp]] last edit on Aug 10, 2005 3:26 AM by rescued_by_c

[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