Advertisement
MeehoweCK

Untitled

Nov 13th, 2020
499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     srand(time(nullptr));
  10.  
  11.     /* modulo operation (rest of the division)
  12.  
  13.     7 % 2 = 1
  14.     17 % 3 = 2
  15.     10 % 5 = 0
  16.     37 % 19 = 18
  17.  
  18.     a % b = c               c is always smaller than b!
  19.  
  20.     rand() % b              the result (a drawn number) will be smaller than b for sure!
  21.  
  22.     */
  23.  
  24.     for(int i = 0; i < 10; ++i)
  25.         cout << rand() % 101 << endl;
  26.  
  27.  
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement