You are on page 1of 21

//header Files

#include<windows.h> //For color changing

#include<iostream> //For cout & cin

#include<conio.h> //For getch

#include <unistd.h> //For sleep

using namespace std;

class Manu

public:

int value;

int Main()

system("COLOR 0B");

int value;

cout<<"\t**************************************\n";

cout<<"\t* Choose *\n";

cout<<"\t* from these options *\n";

cout<<"\t**************************************\n";

cout<<"\t* *\n";

cout<<"\t* *\n";

cout<<"\t* 1.TRAFFIC MANAGEMENT *\n";

cout<<"\t* 2.ACCIDENT *\n";

cout<<"\t* 3.EMERGENCY *\n";

cout<<"\t* 4.CHALLAN *\n";

cout<<"\t* 5.Exit *\n";

cout<<"\t* *\n";

cout<<"\t* *\n";

cout<<"\t**************************************\n";
cout<<"\n\n Place a selection over here: ";

again:

cin>>value;

if(value<1 ||value>5)

system("cls");

cout<<"\t**************************************\n";

cout<<"\t* Choose *\n";

cout<<"\t* from these options *\n";

cout<<"\t**************************************\n";

cout<<"\t**************************************\n";

cout<<"\t* *\n";

cout<<"\t* *\n";

cout<<"\t* 1.TRAFFIC MANAGEMENT *\n";

cout<<"\t* 2.ACCIDENT *\n";

cout<<"\t* 3.EMERGENCY *\n";

cout<<"\t* 4.CHALLAN *\n";

cout<<"\t* 5.Exit *\n";

cout<<"\t* *\n";

cout<<"\t* *\n";

cout<<"\t**************************************\n";

cout<<"\n\nThe previous selection was wrong. Make a selection again:";

goto again;

// class option obj;

// class option ::void selectionpage(value);

void road1()

{
//For First ROAD

HANDLE color = GetStdHandle(STD_OUTPUT_HANDLE);

cout<<"\t\t __________________ "<<endl;

cout<<"\t\t | || | "<<endl;

cout<<"\t\t | ";SetConsoleTextAttribute(color,
10);cout<<"^";SetConsoleTextAttribute(color, 11);cout<<" || 2: | "<<endl;

cout<<"\t\t | ";SetConsoleTextAttribute(color,
10);cout<<"^^^";SetConsoleTextAttribute(color, 11);cout<<" || | "<<endl;

cout<<"\t\t | ";SetConsoleTextAttribute(color, 10);cout<<"^ ^


^";SetConsoleTextAttribute(color, 11);cout<<" || | "<<endl;

cout<<"\t\t ____________| ";SetConsoleTextAttribute(color,


10);cout<<"^";SetConsoleTextAttribute(color, 11);cout<<" || |____________ "<<endl;

cout<<"\t\t| ";SetConsoleTextAttribute(color,
10);cout<<"^";SetConsoleTextAttribute(color, 11);cout<<" | "<<endl;

cout<<"\t\t| ";SetConsoleTextAttribute(color, 10);cout<<"^


>";SetConsoleTextAttribute(color, 11);cout<<" | "<<endl;

cout<<"\t\t| 4: ";SetConsoleTextAttribute(color,
10);cout<<">>>>>>>>>>>>";SetConsoleTextAttribute(color, 11);cout<<" | "<<endl;

cout<<"\t\t| ";SetConsoleTextAttribute(color, 10);cout<<"^


>";SetConsoleTextAttribute(color, 11);cout<<" | "<<endl;

cout<<"\t\t|============ ";SetConsoleTextAttribute(color,
10);cout<<"^";SetConsoleTextAttribute(color, 11);cout<<" ============| "<<endl;

cout<<"\t\t| ";SetConsoleTextAttribute(color, 10);cout<<"<


^";SetConsoleTextAttribute(color, 11);cout<<" 3: | "<<endl;

cout<<"\t\t| ";SetConsoleTextAttribute(color, 10);cout<<"<<<<<<<<


^";SetConsoleTextAttribute(color, 11);cout<<" | "<<endl;

cout<<"\t\t| ";SetConsoleTextAttribute(color, 10);cout<<"< ^


^";SetConsoleTextAttribute(color, 11);cout<<" | "<<endl;

cout<<"\t\t|____________ ";SetConsoleTextAttribute(color, 10);cout<<"^


^";SetConsoleTextAttribute(color, 11);cout<<" ____________| "<<endl;

cout<<"\t\t | ";SetConsoleTextAttribute(color, 10);cout<<"^


^";SetConsoleTextAttribute(color, 11);cout<<" || | "<<endl;
cout<<"\t\t | ";SetConsoleTextAttribute(color,
10);cout<<"^";SetConsoleTextAttribute(color, 11);cout<<" || | "<<endl;

cout<<"\t\t | ";SetConsoleTextAttribute(color,
10);cout<<"^";SetConsoleTextAttribute(color, 11);cout<<" || | "<<endl;

cout<<"\t\t | 1: || | "<<endl;

cout<<"\t\t |________||________| "<<endl;

void road2() //For Second Road

HANDLE color = GetStdHandle(STD_OUTPUT_HANDLE);

cout<<"\t\t __________________ "<<endl;

cout<<"\t\t | || 2: | "<<endl;

cout<<"\t\t | || | "<<endl;

cout<<"\t\t | || ";SetConsoleTextAttribute(color ,
10);cout<<"v";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t | || ";SetConsoleTextAttribute(color ,
10);cout<<"v";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t ____________| || ";SetConsoleTextAttribute(color , 10);cout<<"v


v";SetConsoleTextAttribute(color , 11);cout<<" |____________ "<<endl;

cout<<"\t\t| ";SetConsoleTextAttribute(color , 10);cout<<"v


v";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t| ";SetConsoleTextAttribute(color , 10);cout<<"v v


>";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t| 4: ";SetConsoleTextAttribute(color , 10);cout<<"v


>>>>>>>";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t| ";SetConsoleTextAttribute(color , 10);cout<<"v


>";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t|============ ";SetConsoleTextAttribute(color ,
10);cout<<"v";SetConsoleTextAttribute(color , 11);cout<<" ============| "<<endl;

cout<<"\t\t| ";SetConsoleTextAttribute(color , 10);cout<<"<


v";SetConsoleTextAttribute(color , 11);cout<<" 3: | "<<endl;
cout<<"\t\t| ";SetConsoleTextAttribute(color ,
10);cout<<"<<<<<<<<<<<<";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t ";SetConsoleTextAttribute(color , 10);cout<<"<


v";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t|____________ ";SetConsoleTextAttribute(color ,
10);cout<<"v";SetConsoleTextAttribute(color , 11);cout<<" ____________| "<<endl;

cout<<"\t\t | || ";SetConsoleTextAttribute(color ,
10);cout<<"v";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t | || ";SetConsoleTextAttribute(color , 10);cout<<"v v


v";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t | || ";SetConsoleTextAttribute(color ,
10);cout<<"vvv";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t | 1: || ";SetConsoleTextAttribute(color ,
10);cout<<"v";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t |________||________| "<<endl;

void road3() //For Third Road

HANDLE color = GetStdHandle(STD_OUTPUT_HANDLE);

cout<<"\t\t __________________ "<<endl;

cout<<"\t\t | || 2: | "<<endl;

cout<<"\t\t | || | "<<endl;

cout<<"\t\t | || | "<<endl;

cout<<"\t\t | ";SetConsoleTextAttribute(color ,
10);cout<<"^";SetConsoleTextAttribute(color , 11);cout<<" || | "<<endl;

cout<<"\t\t ____________| ";SetConsoleTextAttribute(color ,


10);cout<<"^^^";SetConsoleTextAttribute(color , 11);cout<<" || |____________ "<<endl;

cout<<"\t\t| ";SetConsoleTextAttribute(color , 10);cout<<"^ ^


^";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t| ";SetConsoleTextAttribute(color ,
10);cout<<"^";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t| 4: ";SetConsoleTextAttribute(color ,
10);cout<<"^";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;
cout<<"\t\t| ";SetConsoleTextAttribute(color ,
10);cout<<"^";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t|============ ";SetConsoleTextAttribute(color ,
10);cout<<"^";SetConsoleTextAttribute(color , 11);cout<<" ============| "<<endl;

cout<<"\t\t| ";SetConsoleTextAttribute(color , 10);cout<<"<


<<<<<<<<<<<<<<<<<";SetConsoleTextAttribute(color , 11);cout<<" 3: | "<<endl;

cout<<"\t\t| ";SetConsoleTextAttribute(color ,
10);cout<<"<<<<<<<<<<<<<<<<<<";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t| ";SetConsoleTextAttribute(color , 10);cout<<"<


v<<<<<<<<";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t|____________ ";SetConsoleTextAttribute(color ,
10);cout<<"v";SetConsoleTextAttribute(color , 11);cout<<" ____________| "<<endl;

cout<<"\t\t | || ";SetConsoleTextAttribute(color , 10);cout<<"v v


v";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t | || ";SetConsoleTextAttribute(color ,
10);cout<<"vvv";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t | || ";SetConsoleTextAttribute(color ,
10);cout<<"v";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t | 1: || | "<<endl;

cout<<"\t\t |________||________| "<<endl;

void road4()

//For Fourth Road

HANDLE color = GetStdHandle(STD_OUTPUT_HANDLE);

cout<<"\t\t __________________ "<<endl;

cout<<"\t\t | || 2: | "<<endl;

cout<<"\t\t | ";SetConsoleTextAttribute(color ,
10);cout<<"^";SetConsoleTextAttribute(color , 11);cout<<" || | "<<endl;

cout<<"\t\t |";SetConsoleTextAttribute(color , 10);cout<<" ^ ^


^";SetConsoleTextAttribute(color , 11);cout<<" || | "<<endl;

cout<<"\t\t ____________| ";SetConsoleTextAttribute(color , 10);cout<<"


^";SetConsoleTextAttribute(color , 11);cout<<" || |____________ "<<endl;
cout<<"\t\t| ";SetConsoleTextAttribute(color , 10);cout<<"
^";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t| ";SetConsoleTextAttribute(color , 10);cout<<">>>>>>>>^


>";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t| 4: ";SetConsoleTextAttribute(color , 10);cout<<"


>>>>>>>>>>>>>>>";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t| ";SetConsoleTextAttribute(color , 10);cout<<">>>>>>>>>>>>>>>>>>v


>";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t|============ ";SetConsoleTextAttribute(color ,
10);cout<<"v";SetConsoleTextAttribute(color , 11);cout<<" ============| "<<endl;

cout<<"\t\t| ";SetConsoleTextAttribute(color ,
10);cout<<"v";SetConsoleTextAttribute(color , 11);cout<<" 3: | "<<endl;

cout<<"\t\t| ";SetConsoleTextAttribute(color ,
10);cout<<"v";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t| ";SetConsoleTextAttribute(color ,
10);cout<<"v";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t|____________ ";SetConsoleTextAttribute(color , 10);cout<<"v v


v";SetConsoleTextAttribute(color , 11);cout<<" ____________| "<<endl;

cout<<"\t\t | || ";SetConsoleTextAttribute(color ,
10);cout<<"vvv";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t | || ";SetConsoleTextAttribute(color ,
10);cout<<"v";SetConsoleTextAttribute(color , 11);cout<<" | "<<endl;

cout<<"\t\t | || | "<<endl;

cout<<"\t\t | 1: || | "<<endl;

cout<<"\t\t |________||________| "<<endl;

};

class Emergency:public Manu

public:

int road;
int n;

void emergency()

cout<<"\t\
t**********************************************************"<<endl;

cout<<"\t\t**********************************************************"<<endl;

cout<<"\t\t** PLEASE PRESS 1 if Ambulance is on 1st road **"<<endl;

cout<<"\t\t** **"<<endl;

cout<<"\t\t** PLEASE PRESS 2 if Ambulance is on 2nd road **"<<endl;

cout<<"\t\t** **"<<endl;

cout<<"\t\t** PLEASE PRESS 3 if Ambulance is on 3rd road **"<<endl;

cout<<"\t\t** **"<<endl;

cout<<"\t\t** PLEASE PRESS 4 if Ambulance is on 4th road **"<<endl;

cout<<"\t\t** **"<<endl;

cout<<"\t\t** PLEASE PRESS 5 if you want to return to Main Menu **"<<endl;

cout<<"\t\t**********************************************************"<<endl;

cout<<"\t\t**********************************************************"<<endl;

ambu:

cin>>road;

if(road<1 || road>5)

system("cls");

cout<<"\t\
t**********************************************************"<<endl;

cout<<"\t\
t**********************************************************"<<endl;

cout<<"\t\t** PLEASE PRESS 1 if Ambulance is on 1st road **"<<endl;

cout<<"\t\t** **"<<endl;
cout<<"\t\t** PLEASE PRESS 2 if Ambulance is on 2nd road **"<<endl;

cout<<"\t\t** **"<<endl;

cout<<"\t\t** PLEASE PRESS 3 if Ambulance is on 3rd road **"<<endl;

cout<<"\t\t** **"<<endl;

cout<<"\t\t** PLEASE PRESS 4 if Ambulance is on 4th road **"<<endl;

cout<<"\t\t** **"<<endl;

cout<<"\t\t** PLEASE PRESS 5 if you want to return to Main Menu **"<<endl;

cout<<"\t\
t**********************************************************"<<endl;

cout<<"\t\
t**********************************************************"<<endl;

cout<<"\t\t Please enter valid value "<<endl;

goto ambu;

if(road==1) //For First ROAD

system("cls");

system("color 0B");

cout<<"\t\tROAD 1 is OPEN"<<endl;

cout<<"\t\tROADS 2nd, 3rd & 4th are CLOSED"<<endl;

cout<<"\t\tAmbulance can go STRAIGHT, LEFT or RIGHT"<<endl<<endl;

road1();

char select;

cout<<"Press Y to return to Emergency Menu. Or any another alphabet for Main


Menu:";

cin>>select;

if(select=='y')

system("cls");

emergency();
}

else

system("cls");

Main();

else if(road==2) //For Second Road

system("cls");

system("color 0B");

cout<<"\t\tROAD 2 is OPEN"<<endl;

cout<<"\t\tROADS 1st, 3rd & 4th are CLOSED"<<endl;

cout<<"\t\tAmbulance can go STRAIGHT, LEFT or RIGHT"<<endl<<endl;

road2();

char select;

cout<<"Press Y to return to Emergency Menu. Or any another alphabet for Main


Menu:";

cin>>select;

if(select=='y')

system("cls");

emergency();

else

system("cls");

Main();

}
}

else if(road==3) //For Third Road

system("cls");

system("color 0B");

cout<<"\t\tROAD 3 is OPEN"<<endl;

cout<<"\t\tROADS 1st, 2nd & 4th are CLOSED"<<endl;

cout<<"\t\tAmbulance can go STRAIGHT, LEFT or RIGHT"<<endl<<endl;

road3();

char select;

cout<<"Press Y to return to Emergency Menu. Or any another alphabet for Main


Menu:";

cin>>select;

if(select=='y')

system("cls");

emergency();

else

system("cls");

Main();

else if(road==4) //For Fourth Road

system("cls");

system("color 0B");

cout<<"\t\tROAD 4 is OPEN"<<endl;
cout<<"\t\tROADS 1st, 2nd & 3rd are CLOSED"<<endl;

cout<<"\t\tAmbulance can go STRAIGHT, LEFT or RIGHT"<<endl<<endl;

road4();

char select;

cout<<"Press Y to return to Emergency Menu. Or any another alphabet for Main


Menu:";

cin>>select;

if(select=='y' || select=='Y')

system("cls");

emergency();

else

system("cls");

Main();

else if(road<=5)

system("cls");

Main();

void accident()

cout<<"\t\t**************************************************\n";
cout<<"\t\t* 1: Accident Menu *\n";

cout<<"\t\t* 2: Return to main menu *\n";

cout<<"\t\t**************************************************\n";

cout<<"\n\tEnter your selection";

repeat:

cin>>n;

system("cls");

if(n<1||n>2)

system("cls");

cout<<"\t\t**************************************************\n";

cout<<"\t\t* 1: Accident Menu *\n";

cout<<"\t\t* 2: Return to main menu *\n";

cout<<"\t\t**************************************************\n";

cout<<"\n\tPlease enter a valid selection:";

goto repeat;

switch(n)

case 1:

int select;

cout<<"\nIn case of accident:\n\n";

cout<<"In case of serious condition call RESCUE: 1122\n";

cout<<"In case of explosion call FIRE BRIGADE: 16\n";

cout<<"\nIf you want to return to menu press any key..... ";

getch();

system("cls");

Main();
}

case 2:

system("cls");

Main();

break;

};

class penalty:public Manu

public:

int s, n, fine, cnic;

char name[30], cat[30];

void challan()

challan:

system("cls");

cout<<"1.Enter Challan Data\n";

cout<<"2.Display Data\n";

cout<<"3.Go to Main Menu\n";

cout<<endl;

cout<<"Place Your selection over here: ";

cin>>s;

if(s==1)

cout<<"Enter no of Persons: ";


cin>>n;

for(int i=1; i<=n; i++)

cout<<"Enter the Name: ";

cin>>name;

cout<<"Enter the CNIC: ";

cin>>cnic;

cout<<"Enter the Challan Category: ";

cin>>cat;

cout<<"Enter the Fine: ";

cin>>fine;

system("cls");

cout<<"Data Entered successfully!\n";

cout<<"Press any key to go back to Challan Menu: ";

getch();

goto challan;

else if(s==2)

system("cls");

cout<<"\tName: \t"<<name<<""<<endl;

cout<<"\tCNIC: \t"<<cnic<<""<<endl;

cout<<"\tCategory:\t"<<cat<<""<<endl;

cout<<"\tFine: \t"<<fine<<""<<endl;

cout<<"Press any key to go to Challam Menu: ";

getch();

goto challan;

}
else if(s==3)

system("cls");

Main();

else

cout<<"Wrong! Select again: ";

goto challan;

};

class traffic:public penalty

//public end

public:

char select;

void traffic_management()

HANDLE color=GetStdHandle(STD_OUTPUT_HANDLE);

//For First road

cout<<"\t\tROAD 1's Light is GREEN "<<endl;

cout<<"\t\tROAD 2nd,3rd & 4th Lights are RED"<<endl;

cout<<"\t\tVehicles can go STRAIGHT, LEFT & RIGHT"<<endl<<endl;

void road1();

// sleep(8);

// timer();

}
//For Second road

cout<<"\t\tROAD 2's Light is GREEN "<<endl;

cout<<"\t\tROAD 1st, 3rd & 4th Lights are RED"<<endl;

cout<<"\t\tVehicles can go STRAIGHT, LEFT & RIGHT"<<endl<<endl;

void road2();

// sleep(8);

// timer();

//For Third Road

cout<<"\t\tROAD 3's Light is GREEN "<<endl;

cout<<"\t\tROAD 1st, 2nd & 4th Lights are RED"<<endl;

cout<<"\t\tVehicles can go STRAIGHT, LEFT & RIGHT"<<endl<<endl;

void road3();

// sleep(8);

// timer();

//For Fourth Road

cout<<"\t\tROAD 4's Light is GREEN "<<endl;

cout<<"\t\tROAD 1st, 2nd & 3rd Lights are RED"<<endl;

cout<<"\t\tVehicles can go STRAIGHT, LEFT & RIGHT"<<endl<<endl;

void road4();

// sleep(8);

// timer();

cout<<"Press Y to return to main menu. Or any other character to exit.";

cin>>select;

if(select=='y' || select=='Y')
{

system("cls");

void Main();

else

void pro_exit();

};

class option:public traffic , public Emergency

public:

// friend class Manu;

void selectionpage(int value)

system("cls");

switch(value)

case 1:

system("cls");

void traffic_management();

break;

case 2:

{
system("cls");

void accident();

break;

case 3:

system("cls");

void emergency();

break;

case 4:

system("cls");

void challan();

case 5:

char option;

system("cls");

cout<<"Press Y to exit. Or enter any alphabet to go to main menu:";

cin>>option;

if(option=='y' || option=='Y')

void pro_exit();

else

system("cls");

void Main();
}

};

int main()

system("COLOR 0B");

cout<<"\t*********************************\n";

cout<<"\t* *\n";

cout<<"\t* TRAFFIC MANAGEMENT *\n";

cout<<"\t* System *\n";

cout<<"\t* *\n";

cout<<"\t*********************************\n";

cout<<"Press any key to continue...";

getch();

system("cls");

cout<<"\t\t****************GROUP MEMBERS*******************\n";

cout<<"\t\t* 1:Kinza Iltaf *\n";

cout<<"\t\t* 2:Fatima Noor *\n";

cout<<"\t\t************************************************\n";

cout<<"Press any key to continue...";

getch();

system("cls");

Manu m;

m.Main();

return 0;
}

You might also like