Coin Toss

I need to ask the user how many times they would like to flip the coin (call the coinToss function) and make the loop execute that number of times by changing some codes. Help.

#include <iostream>
#include <time.h>
using namespace std;


void coinToss();

int main()
{


int srand(time(NULL));

for (int count = 1; count <= 10; count++)
{
coinToss();
}

system("pause");

return 0;
}

void coinToss()
{
int number = 1 + rand() % 2;

cout << (number == 1 ? "heads" : "tails") << endl;
}
Do you know how to ask the user for a number ?
Topic archived. No new replies allowed.