Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- int tail = 0;
- int head = 0;
- void cointoss()
- {
- int coin;
- coin = rand() % 2;
- if (coin == 0)
- {
- head++;
- cout << "head" << endl;
- }
- else
- {
- tail++;
- cout << "tail" << endl;
- }
- }
- int main ()
- {
- srand (time(0) );
- for ( int x = 0; x <10 ; x++ )
- {
- cointoss();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement