home *** CD-ROM | disk | FTP | other *** search
/ Beginning C++ Through Gam…rogramming (2nd Edition) / BCGP2E.ISO / source / chapter01 / game_stats3.cpp < prev    next >
C/C++ Source or Header  |  2004-04-08  |  568b  |  24 lines

  1. // Game Stats 3.0
  2. // Demonstrates constants
  3.  
  4. #include <iostream>
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     const int ALIEN_POINTS = 150;
  10.     int aliensKilled = 10;
  11.     int score = aliensKilled * ALIEN_POINTS;
  12.     cout << "score: " << score << endl;
  13.  
  14.     enum difficulty {NOVICE, EASY, NORMAL, HARD, UNBEATABLE};
  15.     difficulty myDifficulty = EASY;
  16.  
  17.     enum ship {FIGHTER = 25, BOMBER, CRUISER = 50, DESTROYER = 100};
  18.     ship myShip = BOMBER;
  19.     cout << "\nTo upgrade my ship to a Cruiser will cost " 
  20.          << (CRUISER - myShip) << " Resource Points.\n";
  21.  
  22.     return 0;
  23. }
  24.