Class to Main

Hey I was wondering if it is possible to go back to the main() from a class
I tried researching but I don't know what to search.

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
Addition::Addition()
{
	double plus;
	double total = 0;
	string input;
	
	cout << "Simple Calculator v1.1 - Addition \n" << endl;
	cout << "What is the first number you would like to add? (-1 to cancel)" << endl;
	cin >> plus;

	while(plus != -1)
	{
		total = total + plus;
		cout << "What is the next number you would like to add?" << endl;
		cin >> plus;
		total = total + plus;
	}
	total = total - 1;
	cout << "Your numbers you have entered equal to " << total << endl << endl;

	cout << "Would like like to do another sum? y/n" << endl;
	cin >> input;

	if(input == "Y" || input == "y")
	{
             //This is where I want it to return to main()

	}

}
1
2
3
4
5
6
	if(input == "Y" || input == "y")
	{
                //This is where I want it to return to main()
                 return; // type this

	}


You can also use goto btw.
Last edited on
Topic archived. No new replies allowed.