Advertisement
PiotrSzewczyk

Zad 4 losowość

Apr 16th, 2020
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4. using namespace std;
  5.  
  6. int main()
  7.  
  8. {   srand(time(NULL));
  9.     int a=1;
  10.     int b=2;
  11.     int moneta=a+rand()%(b-a+1);
  12.     if (moneta==1){
  13.         cout<<"Wynik to orzel"<<endl;
  14.         }
  15.         else {
  16.             cout<<"Wynik to reszka"<<endl;
  17.         }
  18.     return 0;//uzyskane wyniki będą losowe
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement