Question: Select the function definition that does not follow the lab instructions below: Define a function named CoinFlip that returns Heads or Tails according to a

Select the function definition that does not follow the lab instructions below:
Define a function named CoinFlip that returns "Heads" or "Tails" according to a random value 1 or 0. Assume the value 1 represents "Heads" and 0 represents "Tails".
Group of answer choices
string CoinFlip(void)
{
if (rand()%2==1){
return "Heads";
}
else {
return "Tails";
}
}
string CoinFlip(void)
{
string answer;
if (rand()%2==1){
answer = "Heads";
}
else {
answer = "Tails";
}
return answer;
}
void CoinFlip(void)
{
if (rand()%2==1){
cout << "Heads";
}
else {
cout << "Tails";
}
}
string CoinFlip(void)
{
return (rand()%2==1)? "Heads" : "Tails";
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!