Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib> // biblioteka zawierająca funkcję rand()
- #include <ctime> // biblioteka zawierająca funkcje związane z czasem
- using namespace std;
- int main()
- {
- srand(static_cast<unsigned>(time(nullptr))); // ustawienie startu "maszyny losującej"
- int liczba = 1 + rand() % 100; // przypisuje zmiennej "liczba" resztę z dzielenia wylosowanej liczby przez 100 + 1
- cout << liczba << endl; // w ten sposób zmienna liczba jest w przedziale od 1 do 100
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement