Im new here, i need help. :(

Mar 23, 2013 at 9:43pm
Im new learning C++ and ive been given the job to create a project and i have some short idea in how to do it, but not at all sure to complete it. The project goes like this:


A house is constructed and costs 250,000$ . He will stay with the house for 148 years and then eventually sell it, Im asked to write a program that calculates the price of the house each 10 years until it reaches 148 years of made, how much the house cost then, with an inflation percentage. 
Mar 23, 2013 at 10:19pm
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
#include <cmath>

double inflation(double start, double percent, int years) { return start * std::pow(percent, years); }

int main()
{
   double start = 250000;
   double percent = 0.9; // 90%
   for (int z = 0; z < 148; z += 10)
      cout << "year " << z << " is " << inflation(start, percent, z) << endl;
   cout << "year 148 is " << inflation(start, percent, 148) << endl;
};
Mar 23, 2013 at 10:59pm
Thanksssss really, thats awesome. My doubt is, should the house be worth less every 10 years? I thought it would be worth a bit more
Mar 25, 2013 at 9:21pm
Hi, I still have the doubt in should the house be worth more for every ten years calculated, instead of being worth less?? Because inflation is to be worth more i think.
Mar 25, 2013 at 10:00pm
Shouldn't you figure that one out? Or that information given to you by whoever gave you this job? It doesn't have anything to do with programming.
Topic archived. No new replies allowed.