Question: I want you to write a simple program In c + + that tracks the effects of inflation over 2 0 years on a $
I want you to write a simple program In c that tracks the effects of inflation over years on a $ bill that you
stuff under your mattress. ie It does not pay interest. Create a variable of type double called balance and
initialize its value to Create a second variable of type int called year and initialize its value to the current
year. at the time of writing this. Then create a loop that iterates times and with each iteration do
three things.
Print to the screen the year and the value of balance.
Increment the year by
Modify the balance to lose of its value. Any of these expressions should do the trick.
balance balance
balance balance ;
balance balance balance ;
I will perhaps deduct point if the value you display for or the current year is not In other words
the order in which you do things in a loop matters. Or before a loop, or after a loop, etc. Really think and break
down what needs to be done and the order in which it needs to be done. My list above was written to help you.
Then you can see the true value spending power in dollars of that $ bill over the next two decades.
Ignore the fact that the current inflation rate at the time of writing this is a little over
Also, if you want to simplify your program by not creating a year variable and instead calling the counter
variable in a for loop year and using it for your year, more power to you. Efficiency! You do not have to round
values to the nearest cent, but can if you want to The sample output below shows good values, but if your
implementation of on your specific computer rounds to a different similar value, that is fine too.
Sample Output
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
