Advertisement
MeehoweCK

Untitled

Aug 21st, 2018
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>      // biblioteka zawierająca funkcję rand()
  3. #include <ctime>        // biblioteka zawierająca funkcje związane z czasem
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     srand(static_cast<unsigned>(time(nullptr)));            // ustawienie startu "maszyny losującej"
  10.     int liczba = 1 + rand() % 100;                          // przypisuje zmiennej "liczba" resztę z dzielenia wylosowanej liczby przez 100 + 1
  11.     cout << liczba << endl;                                 // w ten sposób zmienna liczba jest w przedziale od 1 do 100
  12.     return 0;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement