Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <time.h>
- using namespace std;
- int liczba;
- float input;
- int lpowt = 0;
- bool correct;
- main()
- {
- srand(time(NULL));
- liczba = rand()%1000;
- //do debugowania
- //cout << liczba << endl;
- while (correct==false)
- {
- lpowt++;
- cout << "podaj liczbe: ";
- cin >> input;
- cout << endl;
- if (input==liczba)
- {
- correct = true;
- cout << "Dobrze!" << endl;
- cout << "Udalo ci sie po " << lpowt << " probach" << endl;
- }
- if (input > liczba)
- {
- cout << "podana liczba jest zbyt wysoka" << endl;
- }
- if (input < liczba)
- {
- cout << "podana liczba jest zbyt niska" << endl;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement