//int Years, Price, Inflation;
int currPrice, oneYearPrice, twoYearPrice;
cout << "Enter the current price of the item: " << endl;
cin >> currPrice;
cout << endl;
cout << "Enter the price of the item one year ago: " << endl;
cin >> oneYearPrice;
cout << endl;
cout << "Enter the price of the item two years ago: " << endl;
cin >> twoYearPrice;
cout << endl;
}
void increase_decrease()
{
int prevInf, currInf;
double increase_decrease;
if (currInf > prevInf)
{
cout << "The inflation rate is increasing" << endl;
}
else if (currInf < prevInf)
{
cout << "The inflation rate is decreasing" << endl;
}
else
{
cout << "There is no change in the inflation change" << endl;
}
system ("PAUSE");
return 0;
}
I don't know whats wrong with it but could someone help me.
here is the guide that I used
Write a program that outputs inflation rates for two successive years and whether the inflation is increasing or decreasing. Ask the user to input the current price of an item and its price one year and two years ago.
To calculate the inflation rate for a year, Uh, no, that’s wrong! To calculate the inflation rate for a year, subtract the price of the item ONE YEAR AGO from the price of the item for that year and then divide the result by the price a year ago. For example: 2014-Inflation-Rate = (2014-Price minus 2013-Price) / 2013-Price.
Your program must contain at least the following functions:
• a function to get the input
• a function to calculate the results
• a function to output the results