How to create a loop for this?

Could someone please show me how to take this program, and function the exact same way, except include a loop that asks the user "Would you like to add interest?" instead of the interest being automatically added.... it would keep asking the user if they would like to add more interest as long as they answer yes, but when they answer "no" it would complete the program. It also needs to ask the user how much interest they would like to add.

Thank you!!


#include <iostream>
using namespace std;

int main()
{

int duration;
char c;
char s;
double interest;
double ammount;
char account;

cout<<"How much would you like to deposit?"<<endl;
cin>>ammount;
cout<<"Would you like to open a checking account or a saving account?"<<endl;
cout<<"Enter C for checking or S for saving."<<endl;
cin>>account;

if (account=='c'||account=='C')
{
interest=ammount*.05;
}

else if (account=='s'||account=='S')
{
interest=ammount*.1;
}
else
{
cout<<"Wrong type of account! Try again!"<<endl;
cin.get();
cin.get();
return 0;
}




;{
int duration;

cout<<"How many months would you like to open your account for?"<<endl;
cin>>duration
;if (duration>=12&&ammount>=1000)

cout<<"Your balance is "<<ammount+interest<<endl;

else if (duration<12||ammount<1000)

cout<<"Your balance is "<<ammount<<endl;



;cin.get();
cin.get();

return 0;
}
}

Topic archived. No new replies allowed.