1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
#include <iostream>
using namespace std;
void getinp(double* pc, double* p1, double* p2);
void inflationRate(double pc, double p1, double p2, double* rate1, double* rate2);
void showresult(double rate1, double rate2);
#include <iostream>
using namespace std;
void getinp(double* pc, double* p1, double* p2);
void inflationRate(double pc, double p1, double p2, double* rate1, double* rate2);
void showresult(double rate1, double rate2);
int main ()
{
double pc = 0, p1 = 0, p2 = 0, ra1 = 0, ra2 = 0;
getinp(&pc, &p1, &p2);
inflationRate(pc, p1, p2, &ra1, &ra2);
showresult(ra1, ra2);
cin.clear();
cin.ignore(255, '\n');
cin.get();
int loop = 1;
char answer;
do{
cout<<"Do you want program to run again? Yes [Y] or No [N]: "<<endl;
cin>>answer;
switch (answer)
{
case 'Y':
case 'y':
loop = 1;
break;
case 'N':
case 'n':
loop = 0;
break;
default:
cout<<"That is an invalid option, try again with either y or n: "<<endl;
break;
}
}while (loop);
return 0;
|