Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- int losuj(int a, int b)
- {
- srand(time(nullptr)); // ustawienie parametru losowania
- return rand() % (b - a + 1) + a; // zwrócenie wartości funkcji
- }
- int main()
- {
- cout << losuj(100, 3000) << endl; // wywołanie funkcji i wypisanie do konsoli jej wyniku
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement