PROJECT of ROLL in/ ROll out

How Can I call back the int main()?? if i choose 0. how it will go back to int main?? pls help

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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include<iostream>
#include<conio.h>
#include<fstream>
#include<cstdlib>
#include<string>
#include<Windows.h>

using namespace std;
void User(void);

void User(void)
{	
	int departure_area;
	int departure_region;
	int departure_place;
	int departure_port;
	int arrival_area;
	int arrival_region;
	int arrival_place;
	int arrival_port;
	string departure;
	string arrival;
	system("cls");
	cout<<"\n\n\n\t\t!!!!!!!!!!!!!!!!!"<<endl;
	cout<<"\t\t!!Welcome Guest!!"<<endl;
	cout<<"\t\t!!!!!!!!!!!!!!!!!"<<endl;
	cout<<"\t\tPlease Wait";
	Sleep (500);cout<<".";Sleep (500);cout<<".";Sleep (500);cout<<".";Sleep (500);cout<<".";Sleep (500);cout<<".";Sleep (500);cout<<".";
	system("cls");
	area_departure:
	cout<<"\n\n\t\t######   #######   #####   #######  #####  #     #      #     #######  #####  #######  #     # "<<endl;
	    cout<<"\t\t#     #  #        #     #     #       #    ##    #     # #       #       #    #     #  ##    # "<<endl;
	    cout<<"\t\t#     #  #        #           #       #    # #   #    #   #      #       #    #     #  # #   # "<<endl;
	    cout<<"\t\t#     #  #####     #####      #       #    #  #  #   #     #     #       #    #     #  #  #  # "<<endl;
	    cout<<"\t\t#     #  #              #     #       #    #   # #   #######     #       #    #     #  #   # # "<<endl;
	    cout<<"\t\t#     #  #        #     #     #       #    #    ##   #     #     #       #    #     #  #    ## "<<endl;
	    cout<<"\t\t######   #######   #####      #     #####  #     #   #     #     #     #####  #######  #     # "<<endl;
	cout<<"\n\t\t\t\t&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"<<endl;
	cout<<"\t\t\t\t&& Choose Area of Departure &&"<<endl;
	cout<<"\t\t\t\t&&      1. LUZON            &&"<<endl;  
	cout<<"\t\t\t\t&&      2. VISAYAS          &&"<<endl;
	cout<<"\t\t\t\t&&      3. MINDANAO         &&"<<endl;
	cout<<"\t\t\t\t&&      0. Back to admin    &&"<<endl;
	cout<<"\t\t\t\t&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"<<endl;
	cout<<"\t\t\t\tChoose:";cin>>departure_area;
};
int main()
{
	START:
	int AU;
	cout<<"\n\n\t\t###############################################"<<endl;
	cout<<"\t\t#####WELCOME TO MY Roll in/ Roll out OnLINE####"<<endl;
	cout<<"\t\t###############################################"<<endl;
	cout<<"\t\t#####        Please Choose                 ####"<<endl;
	cout<<"\t\t#####        1. Admin                      ####"<<endl;
	cout<<"\t\t#####        2. User                       ####"<<endl;
	cout<<"\t\t#####        0. Exit                       ####"<<endl;
	cout<<"\t\t###############################################"<<endl;
	cout<<"\t\t Choose:";cin>>AU;
	switch (AU)
	{
	case 2: {User();break;}
	case 0:{ system ("exit") ;break;}
	default:{cout<<"Ivalid input!"<<endl;}
	}

	getch();
	return 0;
}
Last edited on
You would want to use a loop, a while loop to be more specific. I havn't read through your code since it's unreadable for the human eye. Please use code tags when presenting code.

http://www.cplusplus.com/articles/jEywvCM9/
Add a loop around your input/switch.
It is ok now
Topic archived. No new replies allowed.