Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int choice;
- do
- {
- string direction;
- cout << "Which direction would you like to move?\n",
- cout << "[8] North\n",
- cout << "[4] West\n",
- cout << "[2] South\n",
- cout << "[6] East\n",
- cout << "[0] Exit\n";
- cin >> choice;
- if (choice >= 2 && choice <= 8 && choice % 2 == 0)
- {
- if (choice == 8)
- direction = "north";
- else if (choice == 4)
- direction = "west";
- else if (choice == 2)
- direction = "south";
- else if (choice == 6)
- direction = "east";
- cout << "You moved " << direction << "." << endl;
- }
- } while (choice != 0);
- return 0;
- }
Add Comment
Please, Sign In to add comment