Advertisement
zCool

Map Selector

May 5th, 2012
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.56 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. void WaitForEnter();
  8. int mapIndex;
  9. string mapName[4] = {"Capitol", "District 1", "District 11", "District 12"};
  10. string mapDescription[4] = {"Where the hunger games are held every year.  It is the capitol \
  11. city of Panem.  The capitol is a wealthy urban city supported by its sourrounding impovershed \
  12. twelve districts." , "District 1 produces luxury items for the capital.  They are known for\
  13. producing 'Careers', children who are chosen to train specifically for the hunger games.", \
  14. "District 11 produces agriculture products, the girl Rue, a 12 year old tribute is from \
  15. District 11.  Rue is frail, but wily as she can manuevar easily in the trees.\
  16. Rue teams up with Katniss during the hunger games until she is killed \
  17. by District 1's Marvel.", "District 12 produces coal, Katniss Everdeen and Peeta Mallark \
  18. are the two hunger games tributes from District 12."};
  19.  
  20. cout << "Hunger Games regions" <<endl
  21.      << "0 - Capitol" << endl
  22.      << "1 - District 1" << endl
  23.      << "2 - District 11" << endl
  24.      << "3 - District 12" << endl
  25.      << "Please enter the index of the map you would like to see a description of: ";
  26.  
  27. cin >> mapIndex;
  28. while(mapIndex <0 || mapIndex >3)
  29. {
  30.     cin.clear();
  31.     cin.ignore();
  32.     cout << "Please enter a number between 0 and 3: ";
  33.     cin >> mapIndex;
  34. }
  35.     cout << endl << mapDescription[mapIndex] <<endl;
  36.     cin.ignore();
  37.     cout << "Please press enter to exit...";
  38.     WaitForEnter();
  39. }
  40.  
  41.  
  42.  
  43. void WaitForEnter()
  44. {
  45.     while ( 1 ) { if ( '\n' == getchar() ) { break; } }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement