Hello everyone, I am trying to loop the entire "main" function, yet for some reason it only loops the termlength_determine() function and then jumps to the 'askloop_function'. i only need it to loop the entire 'main' function

``````//This program calculates the user's pay.
#include <iostream>
using namespace std;

//::integer terms::
int hours_1;
int hours_2;
int hours_3;
int hours_4;
int hours_total;
int term;
double gross_pay;
int loop;
//::if term is 1 week it will use this::
int week1()
{
cout << "how many hours did you work this week?: ";
cin >> hours_1;
system("cls");
return hours_1;
}
//::if term is 2 weeks it will use this::
int week2()
{
int hours_2_1, hours_2_2;
cout << "how many hours did you work during week 1?: ";
cin >> hours_2_1;
cout << "how many hours did you work during week 2?: ";
cin >> hours_2_2;
hours_2 = hours_2_1 + hours_2_2;
system("cls");
return hours_2;
}
//::if term is 3 weeks it will use this::
int week3()
{
int hours_3_1, hours_3_2, hours_3_3;
cout << "how many hours did you work during week 1?: ";
cin >> hours_3_1;
cout << "how many hours did you work during week 2?: ";
cin >> hours_3_2;
cout << "how many hours did you work during week 3?: ";
cin >> hours_3_3;
hours_3 = hours_3_1 + hours_3_2 + hours_3_3;
system("cls");
return hours_3;
}
//::if term is 4 weeks it will use this::
int week4()
{
int hours_4_1, hours_4_2, hours_4_3, hours_4_4;
cout << "how many hours did you work during week 1?: ";
cin >> hours_4_1;
cout << "how many hours did you work during week 2?: ";
cin >> hours_4_2;
cout << "how many hours did you work during week 3?: ";
cin >> hours_4_3;
cout << "how many hours did you work during week 4?: ";
cin >> hours_4_4;
hours_4 = hours_4_1 + hours_4_2 + hours_4_3 + hours_4_4;
system("cls");
return hours_4;
}
//::asks the user the length of their term::
int termlength()
{
cout << "what is your pay term?: " << endl;
cout << "1.) 1 week" << endl;
cout << "2.) 2 weeks" << endl;
cout << "3.) 3 weeks" << endl;
cout << "4.) 4 weeks" << endl;
cin >> term;
system("cls");
return term;
}

int termlength_determine()
{
cout << "hello" << endl;
termlength();

//||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (term == 1)										//||
{	//:: BEGIN OF WEEK 1 IF::					//||
week1();										//||
hours_total = hours_1;							//||
}	//:: END OF WEEK 1 IF::							//||
//||||||||||||||||||||||||||||||||||||||||||||||||||||||
//||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (term == 2)										//||
{	//:: BEGIN OF WEEK 2 IF::						//||
week2();										//||
hours_total = hours_2;							//||
}	//:: END OF WEEK 2 IF::							//||
//||||||||||||||||||||||||||||||||||||||||||||||||||||||
//||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (term == 3)										//||
{	//:: BEGIN OF WEEK 3 IF::						//||
week3();										//||
hours_total = hours_3;							//||
}	//:: END OF WEEK 3 IF::							//||
//||||||||||||||||||||||||||||||||||||||||||||||||||||||
//||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (term == 4)										//||
{	//:: BEGIN OF WEEK 4 IF::						//||
week4();										//||
hours_total = hours_4;							//||
}	//:: END OF WEEK 4 IF::							//||
//||||||||||||||||||||||||||||||||||||||||||||||||||||||
if ((term > 4) || (term == 0))
{
cout << "Please choose a number 1-4:" << endl;
system("pause");
system("cls");
return termlength_determine();
}
return hours_total;
}
int askLoop_function()	//asks if the user would like to calculate again */
{
system("cls");

cout << "Would you like to calculate another pay? (Y/N):";	// asks the question
{
system("cls");
loop == 1;
return loop;
}
{
return 0;
}
{	system("cls");
cout << "please choose Y/N:" << endl;
system("pause");
}
return 0;
}
int main()
{
double tax, pay;
termlength_determine();
cout << "how much do you get paid per hour?: " << endl;
cin >> pay;
system("cls");
cout << "How much tax do you get taken out of your check \n in percent form?:";
cin >> tax;
system("cls");
gross_pay = hours_total * pay - (pay * (.01 * tax));
cout << "your pay after taxes is: \$" << gross_pay << endl;
system("pause");
if(loop == 1)
{
main();
}
return 0;
}``````

Use a do{}while() to loop in main() I would not recommend calling main().

``````int main()
{
do //do enters the loop weather or not the condition at the bottom is met on the first run
{
double tax, pay;
termlength_determine();
cout << "how much do you get paid per hour?: " << endl;
cin >> pay;
system("cls");
cout << "How much tax do you get taken out of your check \n in percent form?:";
cin >> tax;
system("cls");
gross_pay = hours_total * pay - (pay * (.01 * tax));
cout << "your pay after taxes is: \$" << gross_pay << endl;
system("pause");