Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help with this program in c++ language Exercise #2: The first am that will have three functions (printstars, addThem and main): Write a progr function

Help with this program in c++ language image text in transcribed
Exercise #2: The first am that will have three functions (printstars, addThem and main): Write a progr function should be named printstars and will output five stars on a single line. The second function should be named addThem and will accept two numbers (passed as parameters) and return the sum. Finally, the main function will: 1) ask the user to input two numbers 2) call the addThem function that will return the sum, and then 3) execute a loop that will call the printStars function the number of times returned by the addThem function. Exercise #: Create a coin-flipping game. Ask the user how many times to flip the coin, and use the random function to determine heads or tails each time a coin is flipped. Assume the user starts with $50. Every time the coin is flipped calculate the total (heads +$10, tails-$10). Create another function to test if the user has gone broke yet (THIS FUNCTION MUST RETURN A BOOLEAN TRUE/FALSE VALUE). End the program when the user is broke on when the coin was flipped the number of times the user had specified Display: 1) how many times the coin was flipped 2) the number of times "heads" was the result, 3) the number of times "tails" was the result, and 4) how much money the user has at the end

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security XI Status And Prospects

Authors: T.Y. Lin, Shelly Qian

1st Edition

0412820900, 978-0412820908

More Books

Students also viewed these Databases questions

Question

Why arent credit cards money?

Answered: 1 week ago

Question

Write short notes on Interviews.

Answered: 1 week ago