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 20 years on a $100 bill that you
stuff under your mattress. i.e. It does not pay interest. Create a variable of type double called balance and
initialize its value to 100. Create a second variable of type int called year and initialize its value to the current
year. (2023 at the time of writing this.) Then create a loop that iterates 20 times and with each iteration do
three things.
Print to the screen the year and the value of balance.
Increment the year by 1.
Modify the balance to lose 3% of its value. Any of these expressions should do the trick.
balance = balance **0.97
balance -=(balance *0.03);
balance = balance balance **0.03;
I will perhaps deduct 1 point if the value you display for 2023(or the current year) is not 100. 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 2023 dollars) of that $100 bill over the next two decades.
Ignore the fact that the current inflation rate at the time of writing this is a little over 9%.
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 C++on your specific computer rounds to a different similar value, that is fine too.
Sample Output
I want you to write a simple program In c + +

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!