Question
An ancient legend has it that a fabulously wealthy but unthinking king agreed to pay a beggar 1 cent and double the amount everyday for
An ancient legend has it that a fabulously wealthy but unthinking king agreed to pay a beggar 1 cent and double the amount everyday for 64 days.
1) Using this information write a C++ program that uses a for loop and displays how much the king must pay the beggar on each day. The output of your program should appear as follows: (3 points)
Day Amount Owed --- ----------- 1 0.01 2 0.02 3 0.04 4 0.08 . . . . 64 ?
Attention: If you submit your program to see if you have completed this part before moving onto Part 2, then only pay attention to the first "Compare Output" section. The second, third, and fourth compare outputs are for the second part and rely on user input.
2) Modify the application to prompt the user for the amount the king paid the beggar on Day 1 and the # of Days the King agreed to pay the beggar. The output of your program should appear as follows: (3 points)
Please enter the amount the King paid on Day 1: 0.05 Please enter the number of days the King was required to pay the beggar: 5 Day Amount Owed --- ----------- 1 0.05 2 0.10 3 0.20 4 0.40 5 0.80
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started