Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <time.h>
- #include <cstdlib>
- using namespace std;
- //Zad 4; Pseudolosowosc
- int a=1;
- int b;
- int main()
- {
- cout << "Orzel(0) czy reszka(1)?" << endl;
- cin >> b; cout << endl;
- srand(time(NULL));
- if(b==1 || b==0)
- {
- cout <<rand()%(a+1) ;
- }
- else
- {
- cout << "Podales zla wartosc! Podaj liczby z przedzialu (0-1)" << endl;
- }
- //Liczby nie powtarzaja sie w nieskonczonosc co nadaje efekt losowosci.
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment