Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <time.h>
- #include <stdio.h>
- using namespace std;
- int main()
- {
- int a, b, c=0;
- cout << "Siemka! Pomyslalem sobie liczbe..."<<endl;
- srand(time(NULL));
- a=rand()%100+1;
- cout << a;
- cout << "Zgadnij jaka to liczba!" <<endl;
- while (b!=a&&c<=3-1)
- {
- cout << "Podaj liczbe:";
- cin >> b;
- c++;
- if (b>a) cout << "Za duzo!"<<endl;
- else if (b<a) cout << "Za malo!"<<endl;
- }
- if (b==a)
- {
- cout << "Gratulacje! Odgadles moja liczbe!"<<endl;
- cout << "Udalo ci sie mnie pokonac w probie: "<<c<<endl;
- }
- if (b!=a) cout << "Poniosles porazke!";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement