Advertisement
JoannaDobrowolska

Zad 5

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