Pass by reference function

I wrote this program to turn it into a pass by reference function, but I don't know where to start or what to do

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
  #include<iostream>
#include<cmath>
using namespace std;




int main()
{
	int a = 1;
	int TotalInterestPaid;
	int TotalPayment;
	double A, r, t;
	double R, x, y;
	while (a == 1) {
		cout << "Please Enter The Loan Amount:\n";
		cin >> A;
		cout << "Please Enter the Interest Rate:\n";
		cin >> r;
		cout << "Please Enter the Number of Years:\n";
		cin >> t;

		x = r / 1200;
		y = 1 - (pow(1 + x, -12 * t));
		R = A / (y / x);
		TotalPayment = R * (12 * t);
		TotalInterestPaid = TotalPayment - A;

		cout << "Your Monthly Payment is" << "$" << R << endl;
		cout << " Your Total Payment is" << "$" << TotalPayment << endl;
		cout << "Total Interest paid is" << "$" << TotalInterestPaid << endl;
		cout << "===================================================================" << endl;
		cout << "Please enter 1 to continue, or any other number to end the program:" << endl;
		cin >> a;
	}
		return 0;
	
}
@Gpleasehelp

I know you are new here (welcome) but please don't do multiple topics about the same subject, it is ultimately a time waster for those who reply. There is a risk that the same things will be said in both topics. All you question seem to be answered in the other topic.
Topic archived. No new replies allowed.