Skip to content

Instantly share code, notes, and snippets.

@twopoint718
Created August 18, 2011 19:51
Show Gist options
  • Select an option

  • Save twopoint718/1154992 to your computer and use it in GitHub Desktop.

Select an option

Save twopoint718/1154992 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <cmath>
using namespace std;
int main() {
double CostOfItem;
double NumberYears;
double Inflation;
double Result;
cout << " What's the cost of the item ? : " ;
cin >> CostOfItem ;
cout << " Number of years from now that the item will be purchased: " ;
cin >> NumberYears ;
cout << " Enter the rate of Inflation: " ;
cin >> Inflation ;
// Result = CostOfItem*Inflation^X
Result = pow(CostOfItem * (1 + Inflation/100), NumberYears);
cout << Result << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment