Advertisement
Guest User

Untitled

a guest
Oct 19th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 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(static_cast<unsigned>(time(nullptr)));         // inicjacja startu losowania
  10.     int a = rand();     // rand() zwraca liczbę losowaną z przedziału od 1 do 32767
  11.     int b = rand()%100 + 1; // b będzie losowane z przedziału od 1 do 100
  12.     cout << "a = " << a << endl;
  13.     cout << "b = " << b << endl;
  14.     return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement