Advertisement
Guest User

Untitled

a guest
Dec 11th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. char klawisz;
  5. int x=0,y;
  6.  
  7.  
  8. void w(){
  9. x+1;
  10. }
  11. void s(){
  12. x-1;
  13. }
  14. void a(){
  15. y+1;
  16. }
  17. void d(){
  18. y-1;
  19. }
  20.  
  21. void Funkcja(){
  22. cin >> klawisz;
  23. switch ( klawisz )
  24. {
  25. case 'w': w();
  26. break;
  27. case 's': s();
  28. break;
  29. case 'a': a();
  30. break;
  31. case 'd': d();
  32. break;
  33. // default: cout << "Zly klawisz!" // a to co za kierunek? :)
  34. }
  35. cout << x << ", " << y;
  36. Funkcja();
  37. }
  38.  
  39. int main()
  40. {
  41. Funkcja();
  42.  
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement