Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- //Warning No idea how accurate any of this is, please read the book and defer to that, lol.
- void WaitForEnter();
- string direction;
- int mapLocation = 0; //start in capitol
- string mapName[4] = {"Capitol", "District 1", "District 11", "District 12"};
- string mapDescription[4] = {"Where the hunger games are held every year. It is the capitol \
- city of Panem. The capitol is a wealthy urban city supported by its sourrounding impovershed \
- twelve districts." , "District 1 produces luxury items for the capital. They are known for\
- producing 'Careers', children who are chosen to train specifically for the hunger games.", \
- "District 11 produces agriculture products, the girl Rue, a 12 year old tribute is from \
- District 11. Rue is frail, but wily as she can manuevar easily in the trees.\
- Rue teams up with Katniss during the hunger games until she is killed \
- by District 1's Marvel.", "District 12 produces coal, Katniss Everdeen and Peeta Mallark \
- are the two hunger games tributes from District 12."};
- cout << "Hunger Games regions" <<endl
- << "0 - Capitol" << endl
- << "1 - District 1" << endl
- << "2 - District 11" << endl
- << "3 - District 12" << endl
- << "You are in the " << mapName[mapLocation] << endl
- << "Please enter a direction (North, South, East, West): ";
- getline(cin, direction);
- while(direction.compare("North")!=0 && direction.compare("South")!=0 && direction.compare("East")!=0 && direction.compare("West")!=0)
- {
- cout << "Please enter North, South, East or West: ";
- getline(cin, direction);
- }
- if( direction.compare("North") == 0)
- {
- mapLocation = mapLocation - 2;
- if( mapLocation >=0 && mapLocation < sizeof(mapName) -1 )
- {
- cout << "You are in " << mapName[mapLocation] <<endl;
- }
- else
- {
- cout << "Sorry there is nothing North of here\n";
- mapLocation = mapLocation + 2;
- }
- }
- if( direction.compare("South") == 0)
- {
- mapLocation = mapLocation + 2;
- if( mapLocation >=0 && mapLocation < sizeof(mapName) -1 )
- {
- cout << "You are in " << mapName[mapLocation] <<endl;
- }
- else
- {
- cout << "Sorry there is nothing South of here\n";
- mapLocation = mapLocation - 2;
- }
- }
- if( direction.compare("East") == 0)
- {
- mapLocation = mapLocation + 1;
- if( mapLocation >=0 && mapLocation < sizeof(mapName) -1 )
- {
- cout << "You are in " << mapName[mapLocation] <<endl;
- }
- else
- {
- cout << "Sorry there is nothing East of here\n";
- mapLocation = mapLocation - 1;
- }
- }
- if( direction.compare("West") == 0)
- {
- mapLocation = mapLocation - 1;
- if( mapLocation >=0 && mapLocation < sizeof(mapName) -1 )
- {
- cout << "You are in " << mapName[mapLocation] <<endl;
- }
- else
- {
- cout << "Sorry there is nothing West of here\n";
- mapLocation = mapLocation + 1;
- }
- }
- cout << "Please press enter to exit...";
- WaitForEnter();
- }
- void WaitForEnter()
- {
- while ( 1 ) { if ( '\n' == getchar() ) { break; } }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement