2.Write a program to simulate tossing a “fair” coin.Allow the user to enter the
ID: 3611819 • Letter: 2
Question
2.Write a program to simulate tossing a “fair” coin.Allow the user to enter the number of tosses. Print the number oftosses that yielded heads and the number of tosses that yieldedtails. What should the percentage distribution of heads and tails.You should write an integer function that coinFlp() returns 1 if atails was flipped and 0 if a heads was flipped, as well as afunction performFlips(int n), which takes the number of coin flipsto execute. performFlips(int n) should also print the number ofheads and tails to the console. Can someone help me with this program. Thanks! 2.Write a program to simulate tossing a “fair” coin.Allow the user to enter the number of tosses. Print the number oftosses that yielded heads and the number of tosses that yieldedtails. What should the percentage distribution of heads and tails.You should write an integer function that coinFlp() returns 1 if atails was flipped and 0 if a heads was flipped, as well as afunction performFlips(int n), which takes the number of coin flipsto execute. performFlips(int n) should also print the number ofheads and tails to the console. Can someone help me with this program. Thanks! Can someone help me with this program. Thanks!Explanation / Answer
please rate - thanks #include using namespace std; int coinFlip(); void performFlips(int); int main() {int num; coutnum; performFlips(num); system("pause"); return 0; } void performFlips(int n) {int i,tails=0,heads=0; for(i=1;iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.