Hi,

I have a problem with my program. I am making a program on C++ which is about a "fare calcuation system".

I have made the program completely, but I wanted to know that how to use a "looping" in it?


The formula that I have made for fare calculation is:

total fare = tax+fare.

I have also defined the variable for this as:

int tax;
int fare;
int total fare;
total fare = tax+fare
tax = fare * 1/100



This is the portion of the program that I have made:

--------------------------------------------------------------------

Code:


int main()

{

int tax;
int fare;
int total fare;
int y;
int n;





if (fare <=1000)

{ 

cout<<"fare:"; cout<<fare<<"\n";

cout<<"tax:"; cout<<tax<<"\n";

cout<<"-------------------------------------"<<"\n";

cout<<"totalfare:"; cout<<totalfare<<"\n";

cout<<"Do you want to calculate for another person?"<<"\n"; 
cout <<"Enter Y for yes and N to exit>:";
cin >> y;
cin >> n;

}

}

Total fare = tax+ fare.

After this fare is calculated, I have added the option saying:
"do you want to calculate for another person"?

I wanted to know that how can I continue this process ,once the user chooses "y" for "yes" ?

How can I use the loop option to make this continue once the "y" is
entered?

I hope my question is clear

Thanks