Question: IN C PROGRAMMING PLEASE Given main() and the Coin struct, complete function CountHeads() in main.c that counts and returns the number of flips taken to
IN C PROGRAMMING PLEASE




Given main() and the Coin struct, complete function CountHeads() in main.c that counts and returns the number of flips taken to achieve a desired number of heads. Function CountHeads() has a Coin struct and an integer representing the desired number of heads as parameters. Review the Coin struct in "Coin.h" and the function implementations in "Coin.c" uploaded to module 7. A starter main.c is also uploaded. Note: For testing purposes, a Coin struct is created in the main() function using a pseudo-random number generator with a fixed seed value. The program uses a seed value of 15 during development, but when you demo your code to your TA, use a different seed value for each invocation. Ex: If the Coin struct is created with a seed value of 15 and the desired number of heads is 20 , then the function CountHeads() returns 40 and the program outputs: \#ifndef COIN_H_- \#define COIN_H_ \#include \#include typedef struct Coin_struct \{ bool isHeads; int flips; int heads; \} Coin; Coin InitCoin(int seed); Coin Flip(Coin coin); int NumFlips(Coin coin); int NumHeads(Coin coin); int NumTails(Coin coin); bool IsHeads(Coin coin); Pres
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
