Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <windows.h>
  4.  
  5. using namespace std;
  6.  
  7. bool gaz()
  8. {
  9. int acc;
  10. acc = getch();
  11. if( acc == 119 )
  12. return true;
  13. else
  14. return false;
  15.  
  16. }
  17. bool hamulec()
  18. {
  19. int slow;
  20. slow = getch();
  21. if( slow == 115 )
  22. return true;
  23. else
  24. return false;
  25. }
  26. int main()
  27. {
  28. cout<<"Aby uruchomic silnik wcisnij dowolna litere!"<<endl;
  29. if( getch()){
  30. cout<<"Uruchamianie silnika.."<<endl;
  31. Sleep(2000);
  32. cout<<"Silnik uruchomiony poprawnie!"<<endl;
  33. Sleep(2000);
  34. system("cls");
  35. }
  36.  
  37. int predkosc;
  38. predkosc=0;
  39. cout<<"zeby przyspieszyc wcisnij literke w" <<endl;
  40. while(getch)
  41. {
  42. cout<<"Jedziesz "<<predkosc<<" km/h"<<endl;
  43. if( gaz() )
  44. {
  45. predkosc=predkosc+5;
  46. system("cls");
  47. }
  48. else if( hamulec() ){
  49. predkosc=predkosc-5;
  50. system("cls");
  51. }
  52. continue;
  53. }
  54.  
  55.  
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement