Advertisement
Guest User

Untitled

a guest
Mar 20th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     cout << "ZADANIE 1" << endl;
  9.     cout << "Podaj a i b" << endl;
  10.     int a, b;
  11.     cin >> a >> b;
  12.    
  13.     int x;
  14.     x = rand() % (b+1-a) + a;
  15.     cout << x << endl;
  16.     int input;
  17.     do
  18.     {
  19.         cout << "Podaj liczbe" << endl;
  20.         cin >> input;
  21.         if (x > input)
  22.         {
  23.             cout << "x > " << input << endl;
  24.         } else if (x < input)
  25.         {
  26.             cout << "x < " << input << endl;
  27.         }
  28.     } while (x != input);
  29.    
  30.     cout << "Liczba odgatnieta: x = " << input << endl;
  31.    
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement