// This program with "flip a coin" numerous times and report // the number of heads and tails. #include #include #include using namespace std; int main() { int i, j; int heads, tails, amount, result; int t1, t2, t3; // use the time() function in the library time.h to produce // a seemingly truely random number generator srand(time(NULL)); // for ( initialize ; comparison ; increment ) // statement ; // Ask the user for the number of times to flip the coin cout << "Enter an integer to determine the number of numbers generated: "; cin >> amount; for ( i = 0 ; i < amount ; i++ ) { cout << i << " b "; if ( i % 2 == 0) continue; cout << " a " << endl; } cout << endl << endl; for ( i = 0 ; i < amount ; i++ ) { cout << i << " b "; if ( i % 2 != 0) { cout << " a " << endl; } } /* i = 0; while ( i < amount ) { cout << i << " b "; if ( i % 2 == 0) continue; cout << " a " << endl; i++; } */ }