Advertisement
MATI__

Untitled

Apr 30th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <time.h>
  4. using namespace std;
  5. int liczba; int gra;
  6. int main()
  7. {
  8. cout << "Gra o zgadywaniu liczb od 100..0!" << endl;
  9. srand(time(NULL));
  10. liczba = rand()% 100+1;
  11. while (gra!=liczba)
  12. {
  13.  
  14. cout<<"podaj liczbe"<<endl;
  15. cin>>gra;
  16. if(gra==liczba)
  17. {
  18. cout<<"wygrales gre"<<endl;
  19. }
  20. if(gra>liczba)
  21. {
  22. cout<<"to za duza"<<endl;
  23. }
  24. else if(gra<liczba)
  25. {
  26. cout<<"to za malo"<<endl;
  27. }
  28. }
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement