olaaa

Untitled

Nov 5th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <time.h>
  4.  
  5. using namespace std;
  6.  
  7.  
  8. int main()
  9. {
  10. int liczba,strzal=0;
  11.  
  12. srand(time(NULL));
  13. liczba = rand() % 10 + 1;
  14.  
  15. while (strzal != liczba) {
  16. int strzal=0;
  17. cout << "Podaj liczbe z przedzialu od 1-10" << endl;
  18. cin >> strzal;
  19. if (strzal == liczba) {
  20. cout << "Zgadles" << endl;
  21. break;
  22. }
  23.  
  24. if (strzal < liczba) {
  25.  
  26. cout << "Wylosowana liczba jest wieksza" << endl;
  27. }
  28. else {
  29. cout << "Wylosowana liczba jest mniejsza" << endl;
  30. }
  31.  
  32.  
  33.  
  34.  
  35. }
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment