Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- using namespace std;
- int main()
- {
- cout << "ZADANIE 1" << endl;
- cout << "Podaj a i b" << endl;
- int a, b;
- cin >> a >> b;
- int x;
- x = rand() % (b+1-a) + a;
- cout << x << endl;
- int input;
- do
- {
- cout << "Podaj liczbe" << endl;
- cin >> input;
- if (x > input)
- {
- cout << "x > " << input << endl;
- } else if (x < input)
- {
- cout << "x < " << input << endl;
- }
- } while (x != input);
- cout << "Liczba odgatnieta: x = " << input << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement