Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- using namespace std;
- enum class kierunek
- {
- gora = 73, lewo = 74, dol = 75, prawo = 76
- };
- int main()
- {
- char direction;
- kierunek ruch;
- for(short i = 0; i < 10; ++i)
- {
- do
- {
- direction = getch();
- direction = toupper(direction); // zwiększa do dużej litery
- }
- while(direction != 'J' && direction != 'K' && direction != 'L' && direction != 'I');
- ruch = static_cast<kierunek>(direction);
- switch(ruch)
- {
- case kierunek::gora:
- cout << "w gore\n";
- break;
- case kierunek::dol:
- cout << "w dol\n";
- break;
- case kierunek::lewo:
- cout << "w lewo\n";
- break;
- case kierunek::prawo:
- cout << "w prawo\n";
- break;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement