Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- class kolo{
- public:
- double rychlost = 0;
- void zrychli(int);
- void brzdi(int);
- };
- void kolo::zrychli(int x){
- rychlost = rychlost + x;
- }
- void kolo::brzdi(int x){
- if (x >= 100)x = 100;
- x = 100 - x;
- rychlost = (rychlost*x) / 100;
- }
- void main(){
- kolo kolo1;
- int x;
- bool jede = true;
- while (jede)
- {
- cout << "Zadejte zrychleni: \n";
- cin >> x;
- kolo1.zrychli(x);
- cout << "Zadejte zrychleni v procentech: \n";
- cin >> x;
- kolo1.brzdi(x);
- cout << kolo1.rychlost;
- if (kolo1.rychlost == 0) jede = false;
- cout << "\n";
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement