Lee_assign23 - srand(time(0 cout<<"The number of...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
//Cheu Lee Assing 23 #include <iostream> #include <cmath> #include <ctime> void flipCoin(int); using namespace std; int main() { int n; cout<<"How many times do you want flip the coin?"<<endl; cin>>n; flipCoin(n); return 0; } void flipCoin(int n) { int side, H=0, T=0;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: srand(time(0)); cout<<"The number of heads: "<<endl; for (int a=0; a<n; a++){ cout<<a; for (int i=0; i<12; i++){ side=rand()%2; if (side==1){ cout<<"*"; H+=1; } if (side==0){ T+=1; } } cout<<endl; } }...
View Full Document

This note was uploaded on 05/16/2010 for the course CISCO EST61 taught by Professor Miller during the Spring '10 term at Fresno City College.

Ask a homework question - tutors are online