Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main()
- {
- enum Directions {North,South,East,West};
- /*
- const int North{ 0 };
- const int South{ 1 };
- const int East{ 2 };
- const int West{ 3 };
- */
- int direction{ 0 };
- std::cout << "Enter direction code N - 0, S - 1, E - 2, W - 3 \n";
- std::cin >> direction;
- switch (direction)
- {
- case Directions::North:
- std::cout << "You direction is North\n";
- break;
- case Directions::South:
- std::cout << "You direction is South\n";
- break;
- case Directions::East:
- std::cout << "You direction is East\n";
- break;
- case Directions::West:
- std::cout << "You direction is West\n";
- break;
- default:
- std::cout << "Unknown direction\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment