Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- using namespace std;
- void ruch()
- {
- char komenda;
- while(true)
- {
- do
- {
- komenda = getch();
- komenda = toupper(komenda);
- } while(komenda != 'A' && komenda != 'S' && komenda != 'D' && komenda != 'W');
- switch(komenda)
- {
- case 'A':
- cout << "w lewo\n";
- break;
- case 'W':
- cout << "w gore\n";
- break;
- case 'D':
- cout << "w prawo\n";
- break;
- case 'S':
- cout << "w dol\n";
- }
- }
- }
- int main()
- {
- ruch();
- }
Advertisement
Add Comment
Please, Sign In to add comment