Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- int main()
- {
- srand(time(nullptr));
- /* modulo operation (rest of the division)
- 7 % 2 = 1
- 17 % 3 = 2
- 10 % 5 = 0
- 37 % 19 = 18
- a % b = c c is always smaller than b!
- rand() % b the result (a drawn number) will be smaller than b for sure!
- */
- for(int i = 0; i < 10; ++i)
- cout << rand() % 101 << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement