Write a program to gauge the rate of inflation for the past year. The program asks for the price of an item (such as a hot dog or a one-carat diamond) both one year ago and today. It estimates the inflation rate as the difference in price divided by the year-ago price. Your program should allow the user to repeat this calculation as often as the user wishes. Define a function to compute the rate of inflation. The inflation rate should be a value of type double giving the rate as a percentage, for example 5.3 for 5.3%.
//i dont see you using this function any where
bool(check_for_prices) //defining a function below main must have a declaration above main
{
cout<< "Do you want to continue (Y/N)?";
cout<< "Please Press Y to continue or N to exit." << endl;
cin >> again;
}
while((again=='Y')&&(again=='y')); //again's scope is only limited to main,
//and your while loop is not part of any scope
for repeation, just use a do while loop.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
int main()
{
do
{
//all that stuff in main,
//what you wanted check_for_prices to do
cout<< "Do you want to continue (Y/N)?";
cout<< "Please Press Y to continue or N to exit." << endl;
cin >> again
}while((again=='Y')||(again=='y')); //take not of the change from && to ||
//again can never be 'Y' and 'y' at the same time
system("pause");
return 0;
}