Advertisement
Guest User

zad2/6

a guest
Oct 22nd, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <time.h>
  4. #include <stdio.h>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     int a, b, c=0;
  11.     cout << "Siemka! Pomyslalem sobie liczbe..."<<endl;
  12.     srand(time(NULL));
  13.     a=rand()%100+1;
  14.     cout << a;
  15.     cout << "Zgadnij jaka to liczba!" <<endl;
  16.     while (b!=a&&c<=3-1)
  17.     {
  18.         cout << "Podaj liczbe:";
  19.         cin >> b;
  20.         c++;
  21.         if (b>a) cout << "Za duzo!"<<endl;
  22.         else if (b<a) cout << "Za malo!"<<endl;
  23.     }
  24.     if (b==a)
  25.     {
  26.     cout << "Gratulacje! Odgadles moja liczbe!"<<endl;
  27.     cout << "Udalo ci sie mnie pokonac w probie: "<<c<<endl;
  28.     }
  29.     if (b!=a) cout << "Poniosles porazke!";
  30.  
  31.  
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement