Cant understand the assignment!

Apr 25, 2015 at 1:40pm
Hello everyone, Not trying to get you to do my homework for me, But
can someone explain to me what is this assignment is about?
can you simplify it for me, because I am still in CS1 and it is getting complex for me.
thank you,

Write a program using Functions to determine the difference in the price of an item over the past year. The program ask for the price of an item(such as a pizza or 1 Kilogram of gold) both one year ago and today. It than estimate the difference in price. Define a function to compute the difference in price. The difference in price for the past year should be a value of type double, for example $10.3. Your program should allow the user to repeat this calculation as often as the user wishes.
Apr 25, 2015 at 1:47pm
Create a function that takes in 2 doubles and returns a double (the difference of the 2 parameters).

In your main function, create a loop that asks for 2 doubles, and calls your function with those doubles passed as parameters.
Apr 25, 2015 at 3:36pm
thank you for the quick reply.
so basically it should be a
cout "enter the price last year and the new price for 1 kilogram of gold"
then
cin old_price and new_price.

and then basically there should be a return function (or definition) that computes the difference in price (new price - old price = difference)

but why you say I should create a loop that asks for 2 doubles? the professor isn't asking for a loop!

thank you,
Apr 25, 2015 at 5:05pm
Your program should allow the user to repeat this calculation as often as the user wishes.

^ Loop
Topic archived. No new replies allowed.