Trying to return to start or continue program

Hello, I am currently writing a program for my Programming class. I know that homework questions are not supposed to be asked, however what I am trying to do is beyond what was assigned and unnecessary: I would just like it in the program. The goal is to make an interest calculator, allowing the user to input values and returning the calculated interest. I don't want help coding any of that, I just want to give the user the option of restarting the program once they have input all the values, in case they got one wrong and want to change it. I have searched for an answer and have been able to restart the program or continue, just not with the values for the variables carrying over after continuing. The code below is what I have so far, with the points I would like to restart to and from, or to continue from noted. The rest of the code is homework and I would not like help editing it. The program is also incomplete after the point that says //Begin calculations here right after the restart
I am using Visual studio 2013 on a windows 8 machine.

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
52
53
54
  
#include <iostream> 
#include <cmath>
using namespace std;
int main()
{
//**** I would like to restart the program from here if the user selects "n"
			
	// Variable declaration
	double LoanAmount, Term, YearlyInterest, Insurance, Interest, MonthlyPayment, HomeWorth, PercentTax, NumberofPayments, Rate, PropertyTax, FractionTax;	
		//Begin User Interface here 
		cout << "This program will calculate how many payments you will make on your house," << endl;
		cout << "including the amount of your insurance and property tax." << endl;
		cout << "How much is your loan?" << endl;
		cout << "Dollars:",
			cin >> LoanAmount;
		cout << "Your Loan is " << LoanAmount << "$" << endl;
		cout << "What is the term of the loan in years?" << endl;
		cout << "Years:",
			cin >> Term;
		cout << "You have a " << Term << " year Loan" << endl;
		cout << "What is your yearly interest rate?" << endl;
		cout << "Percent:",
			cin >> YearlyInterest;
		cout << "You Pay " << YearlyInterest << "% Per year" << endl;
		cout << "How much does your Homeowner's insurance cost per month?" << endl;
		cout << "Insurance:",
			cin >> Insurance;
		cout << "Insurance costs " << Insurance << "$ per month" << endl;
		cout << "How much is your home worth?" << endl;
		cout << "Dollars:",
			cin >> HomeWorth;
		cout << "Your Home is worth " << HomeWorth << "$" << endl;
		cout << "What percentage do you pay per year for tax?" << endl;
		cout << "Percent:",
			cin >> PercentTax;
		cout << "Property Tax in your jurisdiction is " << PercentTax << "%" << endl;
		cout << "Please review that the above information is correct, and hit y to continue, n to restart" << endl;
		cout "(y/n)";
// ******* I would like to have the user press 'y' to continue or 'n' to restart back to the beginning here.
	
//This code meant for the calculating. I want the numbers assigned to the variables to carry over past the decision to continue and be used here. 
	//Begin calculations here, end user interface
	FractionTax = PercentTax * .01;
	Rate = (YearlyInterest / 12)* .01;
	NumberofPayments = Term / 12;
	PropertyTax = NumberofPayments * HomeWorth * FractionTax;
	Interest = ((Rate)* pow((1 + Rate), NumberofPayments) / (pow((1 + Rate), NumberofPayments) - 1)) * LoanAmount;
	MonthlyPayment = Insurance + Interest + PropertyTax;
	//User Interface Display Begins
	cout <<" Your Loan: "<< LoanAmount << "$"<< endl;
	cout << "Term: " << Term << endl;
	cout << "You will pay" << MonthlyPayment << "$ per month for" << NumberofPayments << " months" << endl; 
	return 0;
do while loop
That works, thank you
Topic archived. No new replies allowed.