Question: Hello, I need help solving this Lab simulation, It uses Flip a coin for function statements and I am very new at coding on so
Hello, I need help solving this Lab simulation, It uses Flip a coin for function statements and I am very new at coding on so I need help solving it. It is very difficult. It is very confusing since the there are multiple inputs and on can only code it once.
A program that simulates flipping a coin to make decisions. The input is how many decisions are needed, and the output is either heads or tails. Assume the input is a value greater than 0. If the input is 3, the output is:
heads tails heads For reproducibility needed for auto-grading, seed the program with a value of 2. In a real program, you would seed with the current time, in which case every program runs output would be different, which is what is desired but can't be auto-graded.
Your program must define and call a function:string HeadsOrTails()that returns "heads" or "tails".
NOTE: A common student mistake is to call srand() before each call to rand(). But seeding should only be done once, at the start of the program, after which rand() can be called any number of times.
#include
#include
using namespace std;
/* Define your function here */
int main() {
/* your code here. */
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
