RafalSobala

zad5/rand

Apr 6th, 2020
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4.  
  5. using namespace std;
  6. int a=-1000,b=1000,wynik=0,c;
  7. int main()
  8. {
  9.     srand(time(NULL));
  10.     do{
  11.         c=a+rand()%(b-a+1);
  12.         cout << c << endl;
  13.  
  14.         if(c>100 && c<200){
  15.             wynik=1;
  16.         }
  17.  
  18.     }while(wynik==0);
  19.     return 0;
  20. }
Add Comment
Please, Sign In to add comment