so basically T is two dollar and H is also Two dollar but ends coinflip.
This is what my professor expect to see if he runs it.
TTTHYou win $16.00
THYou win $4.00
THYou win $4.00
HYou win $2.00
TTTTHYou win $32.00
THYou win $4.00
HYou win $2.00
HYou win $2.00
THYou win $4.00
THYou win $4.00
The average payout was $7.40
This is what I wrote and nothing is display
#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
int main()
{ srand(time(0));
int i;
bool out= true;
double money = 0, total = 0, average;
for (i = 1; i <= 10; i++)
{
int coinflip = rand() * 2 + 1;
do
{
if (coinflip == 1)
{
cout << "T";
money = 2.00;
total *= money;
}
if (coinflip == 2)
{
cout << "H" << endl;
total * 2;
if (total = 0)
total = 2.00;
out = false;
}
} while (out);
cout << "You win $ " << total;
}
average = total / 10;
cout << "The average payout was $" << average << endl;