Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <windows.h>
- using namespace std;
- bool gaz()
- {
- int acc;
- acc = getch();
- if( acc == 119 )
- return true;
- else
- return false;
- }
- bool hamulec()
- {
- int slow;
- slow = getch();
- if( slow == 115 )
- return true;
- else
- return false;
- }
- int main()
- {
- cout<<"Aby uruchomic silnik wcisnij dowolna litere!"<<endl;
- if( getch()){
- cout<<"Uruchamianie silnika.."<<endl;
- Sleep(2000);
- cout<<"Silnik uruchomiony poprawnie!"<<endl;
- Sleep(2000);
- system("cls");
- }
- int predkosc;
- predkosc=0;
- cout<<"zeby przyspieszyc wcisnij literke w" <<endl;
- while(getch)
- {
- cout<<"Jedziesz "<<predkosc<<" km/h"<<endl;
- if( gaz() )
- {
- predkosc=predkosc+5;
- system("cls");
- }
- else if( hamulec() ){
- predkosc=predkosc-5;
- system("cls");
- }
- continue;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement