Code:
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<conio.h>
#include<windows.h>
#define BLACK 0
#define GREEN 2 //define colour code
void choose1(void);
void choose2(void);
void choose3(void);
void pricecalc(void);
void pricecalc1(void);
void seat(void);
void clrscr(void);
void fullScreen(void);
void Color(int BackgroundColor,int TextColor);
void pas(void);
void main()
{
int option;
fullScreen();
Color(BLACK,GREEN);
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
printf(" ## ## ###### ## ##### ##### ## ## # ##### ## ## \n");
printf(" ## ## ## ## ## ### ## ## ## ### ### ## ## ## ## \n");
printf(" ## ## # # ## ## ## ## # ## ## ## ## ## ## ### ## ## ## \n");
printf(" ## #### ## ######## ## ## ## ## ## ## ## ######### ## ## \n");
printf(" ### ## ## ### ### ## ## ## ## ## ## ## ## ## \n");
printf(" ##### ##### ### ## ## # ## ## ## ## ## ## ## \n");
printf(" #### #### ### # ## ### ## ## ## ## ## ## # \n");
printf(" ## ## ###### ###### #### ##### ## ## ###### ## ## \n");
printf("\n\n\n\n\n\n\n\n\n\n\n\n\t");
printf("\t\twelcome to MS PEARL AIRLINES...\n");
system("pause");
system("cls");
printf("\n\n\n\n\n\n\n\n\n\n\n");
printf("Enter your option..?\n1=first class\n2=economy
class\n3=Interactive menu\n\nOption= ");
scanf("%d",&option);
if(option==1)
{
printf("welcome to the first class seat\n");
choose1();
}
else if(option==2)
{
printf("welcome to the economy class\n");
choose2();
}
else if(option>=3)
{
printf("wrong option sir\n");
choose3();
}
}
void choose1(void)
{
int age;
char cus[25];
char fname[25];
char lname[25];
char gend[7];
char mail[50];
printf("please enter your name sir=");
scanf("%s",&cus);
clrscr();
printf("\n\n\n\t\tonline ticket booking to mr/miss %s
\n\t___________________________________________________\n",cus);
printf("please enter your particular details\n");
printf("FIRST NAME : ");
scanf("%s",&fname);
printf("LAST NAME : ");
scanf("%s",&lname);
printf("AGE : ");
scanf("%d",&age);
printf("GENDER : ");
scanf("%s",&gend);
printf("mailing address : ");
scanf("%s",&mail);
clrscr();
pas();
clrscr();
printf("Please choose your seat\n");
printf(" _______________________________\n");
printf("|\t\t\t\t\|\n|\t\t\t\t|\n|\t\t\t\t|\n|\t\t\t\t|\n|\t\t\t\t|\n|\t\t\t\t|\n|\t\t\t\t|\n|\t\t\t\t|\n|\t\t\t\t|\n|\t\t\t\t|\n|\t\t\t\t|\n|\t\t\t\t|\n|\t\t\t\t|\n|________________________________\n\n\n");
seat();
clrscr();
printf("\t\t\t Booking Form
Confirmation\n\t\t\t*********************************\n\n\n");
printf("Name = %s\n",strcat(fname, lname));
printf("Mailing Addreses= %s\n\n ",mail);
}
void choose2 (void)
{
int age3;
char cus3[25];
char fname3[25];
char lname3[25];
char gend3[7];
char mail3[50];
printf("please enter your name sir=");
scanf("%s",&cus3);
clrscr();
printf("\n\n\n\t\tonline ticket booking to mr/miss %s
\n\t___________________________________________________\n",cus3);
printf("please enter your particular details\n");
printf("FIRST NAME : ");
scanf("%s",&fname3);
printf("LAST NAME : ");
scanf("%s",&lname3);
printf("AGE : ");
scanf("%d",&age3);
printf("GENDER : ");
scanf("%s",&gend3);
printf("mailing address : ");
scanf("%s",&mail3);
clrscr();
pas();
clrscr();
printf("Please choose your seat\n");
printf(" _______________________________\n");
printf("|\t\t\t\t\|\n|\t\t\t\t|\n|\t\t\t\t|\n|\t\t\t\t|\n|\t\t\t\t|\n|\t\t\t\t|\n|\t\t\t\t|\n|\t\t\t\t|\n|\t\t\t\t|\n|\t\t\t\t|\n|\t\t\t\t|\n|\t\t\t\t|\n|\t\t\t\t|\n|________________________________\n\n\n");
}
void choose3 (void)
{
printf("jhsda\n");
}
void seat(void)
{
char seat[4];
printf("please choose you seat= ");
scanf("%s",seat);
return seat;
}
void clrscr(void)
{
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
COORD coord = {0, 0};
DWORD count;
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(hStdOut, &csbi);
FillConsoleOutputCharacter(hStdOut, ' ', csbi.dwSize.X *
csbi.dwSize.Y, coord, &count);
SetConsoleCursorPosition(hStdOut, coord);
}
void fullScreen( void )
{
keybd_event( VK_MENU , 0x38 , 0 , 0 );
keybd_event( VK_RETURN , 0x1c , 0 , 0 );
keybd_event( VK_RETURN , 0x1c , KEYEVENTF_KEYUP , 0 );
keybd_event( VK_MENU , 0x38 , KEYEVENTF_KEYUP , 0 );
}
void Color(int BackgroundColor,int TextColor)
{
int SeclectedColor=(7*BackgroundColor)+(TextColor);
HANDLE hConsole;
hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole,SeclectedColor);
}
void pas(void)
{
int ages;
char fname1[25],lname1[25];
printf("\n\n\n\n\n");
printf("Please enter your particular passenger order\n");
printf("FIRST NAME : ");
scanf("%s",&fname1);
printf("\nLAST NAME : ");
scanf("%s",&lname1);
printf("\nAGE : ");
scanf("%d",&ages);
if(ages<=7)
{
pricecalc();
}
else if(ages>=8)
{
printf("\nFor an adult the price is RM120\n");
}
else if(ages>=56)
{
printf("For gold citizen the price is RM90\n");
}
}
void pricecalc(void)
{
int price;
price=120/2;
printf("\nFor the children the price is =RM%d due to 50 percent
discounts\n",price);
return price;
}