Question 1

Write a program that uses a variable inside of a for loop to output the following pattern:

2
4
8
16
32
64
128
256
512
1024

It should match the following output: see image.

Question 2:

Write a program that will calculate savings by buying tickets in bulk. The ticket cost per ticket is $64.50 per ticket. Have the user enter the number of tickets to purchase. If the user selects a number greater than 5, apply a 25% discount per ticket. Otherwise, apply a 5% discount per ticket. Output the results

It should match the following output: see image. see image.

Question 3:

Write a program that simulates tossing a coin using a function named CoinToss(). The function should take no arguments, but return a string "Heads" or "Tails" back to main.

Inside of CoinToss(), you will need to get a random number using rand() and limit that return to either a zero or a one. If the number returned from rand is zero, return "Heads" back to main. If the random number is one, return the string "Tails" back to main.

In main, ask the user to input the amount of times they wish to run the coin toss simulator. You must use a loop to control the function call of CoinToss().

Think: This is a known counted number of times that you will be asking for CoinToss() function to run. Use the right counted loop.

A successful program will look like the following: see image. see image.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.