I'm facing a problem with this question:
Write a function void:
bool tossCoin (bool& flag);
The function returns true to indicate head (45% chance), false for tail (45% chance). There is 10% chance that the toss will fail, example not landing on a face; if this happens the flag is set to false, and the caller must call the function again (toss the coin again).
Test the function with a program that prompts the user for his/her choice (0 tail, 1 head) then calls the function to find if the user will win or not. If the flag is set to false by the function you must print a message that indicates re-tossing the coin is required,
Hint: you have to use rand() functions
My problem is I don't know how to begin approaching this question and how to do it correctly?