Advertisement
LukaszPanko

Zad 4

Apr 17th, 2020
171
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.  
  8.  
  9. int main()
  10. {
  11.     int a = 1;
  12.     int b = 2;
  13.     srand( time( NULL ) );
  14.     cout<<"Rzut moneta"<<endl;
  15.      cout<<a+rand()%(b-a+1)<<endl;
  16.     if(a+rand()%(b-a+1)==1)
  17.     {
  18.         cout<<"wypadla reszka";
  19.     }
  20.     else{
  21.         cout<<"wypadl orzel";
  22.     }
  23.     //*Program wyœwietla wartosci wygladajace losowo ale takie nie sa
  24.  
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement