This document describes a C program for a train ticket reservation system. The program allows the user to select their destination, number of passengers, and ticket class (business or economy). It then calculates and displays the ticket price, meal expenses, departure time, and total cost. The program uses macros to define repeated text and switches to handle different destination and class options. It calls a menu function that allows the user to make selections and see the results.
1. Project title:”TRAIN TICKET RESERVATION CENTER”
Your name :”RIDA BILGRAMI"| Your teacher’s name :”MISS MAHRUKH
MAZHARI”| Your Field:” B.C.S (IST SEMESTER)”
2. #include<stdio.h>
#include<conio.h>
#include<string.h>
char manue(void);
#define DESTINY printf("nnttt"PLEASE ENTER YOUR DESTINY WHERE YOU WANT
TO GO:"nn")printf("nnttt"PRESS 'F' or 'f' for
FAISALABAD"nn")printf("nnttt"PRESS 'L' or 'l' for
LAHORE"nn")printf("nnttt"PRESS 'P' or 'p' for
PESHAWAR"nn")scanf("%c",&des[1])des[1]=getchar()switch(des[1]){
#define SERVICE printf("nnttt"WE WILL SERVE YOU OUR BEST SERVICE"nn");
#define PERSONS printf("PLEASE ENTER NUMBER OF PERSONS WANTS TO GO")
scanf("%d",&per);
#define DEPARTURE printf("nnttt"YOUR'S DEPARTURE TIME IS AT 2:00 PM:"nn");
#define MEALEXPENSE printf("nnttt"YOUR TOTAL MEAL EXPENSE IS %dRs/-
only"nn",me);
#define TOTALEXPENSE printf("nnttt"YOUR TOTAL EXPENSE IS %dRs/-
only"nn",te)break;
3. #define ERROR default:printf("nnnttttERROR!!!...nnn");
#define ENTERYS int nic[]int pchar name[]printf("nnntttenter your nic number
:n")scanf("%d",&nic[])printf("nnntttenter NAME :n")scanf("%s",&name[]
)printf(“nnnttenter the
destinynn”)scanf(“%s”,des[1])for(p=1;p<=name[];p++){printf("nnttYOUR SEAT
NUMBER IS %d",p)printf("nnnttt Your Seat has Reserved .. nthank you for reserving
with us nn")for(p=1;p<=20;p++){printf("tx03")}
void main(void)
{
int i;
char j=1,k=4;
char ch=getchar();
clrscr();
4. for(i=1;i<=80;i++)
{
printf("t%ct%c",j,k);
}
printf("nntt******xcdxcdWELCOME TO TRAIN TICKET RESERVATION
SYSTEMxcdxcd******tttn");
printf("nnttt: :*@*@ A WAY TO FACILITATE YOU...@*@*::ttt");
printf("nnttt DESIGNED AND CODED BY ..nnnntttxcdxcdxcd RIDA SARWAR
BILGRAMI , RABIA , AFRA & GULAFSHANxcdxcdxcdnn");
for(i=1;i<=80;i++)
{
printf("t%ct%c",j,k);
}
5. printf("press any alpha key to continue....");
scanf("%c",&ch);
if(getchar()<=122)
{
manue();
}
else
printf("you entered invalid key.......");
getch();
}
6. char manue(void)
{
char c=getchar();
char des=getchar();
char reg[3];
int per,me,te=0;
printf("nnttxbcxbcxbc ** MAIN MANUE ** xbcxbcxbcttt");
printf("nnttxcdxcdxcd "RESERVE A SEAT IN YOUR'S CHOICE
CLASS:"xcdxcdxcdttnn");
printf("nnttt ** xcdxcdxcd ** MAKE YOUR OWN CHOICE ** xcdxcdxcd **");
printf("nnttt PRESS 'B' or 'b' for:"COMPLETE YOUR SEAT RESERVATION IN
BUISNESS CLASS"nntt");
printf("nnttt PRESS 'E' or 'e' for:"COMPLETE YOUR SEAT RESERVATION IN
ECONOMY CLASS"nntt");
8. printf("nnttt WE WILL SERVE YOU:"Hi-Tea=300/-only"tt"Dinner=500/
only"tt"Breakfast=300/-only"nn");
me=per*1100;
MEALEXPENSE
te=(4000*per)+me;
TOTALEXPENSE
case 'L':
case 'l':
SERVICE
printf("nnttt"YOUR TICKET PRICE IS 4500/-"nn");
PERSONS
printf("nnttt"YOUR'S DESTINY DURATION IS 17 HOURS:"nn");
DEPARTURE
9. printf("nnttt"WE WILL SERVE YOU:"Hi-Tea=300/-only"tt"Dinner=500/-
only"tt"Breakfast=300/-only"nn");
me=per*1100;
MEALEXPENSE
te=(4500*per)+me;
TOTALEXPENSE
case 'P':
case 'p':
SERVICE
printf("nnttt"YOUR TICKET PRICE IS 6000/-"nn");
PERSONS
printf("nnttt"YOUR'S DESTINY DURATION IS 25 HOURS:"nn");
DEPARTURE
11. case 'e':
case 'E':
DESTINY
case 'F':
case 'f':
SERVICE
printf("nnttt"YOUR TICKET PRICE IS 1000/-"nn");
PERSONS
printf("nnttt"YOUR'S DESTINY DURATION IS 15 HOURS"nn");
DEPARTURE
printf("nnttt"WE WILL SERVE YOU:"Hi-Tea=100/-only"tt"Dinner=200/-
only"tt"Breakfast=100/-only"nn");
me=per*400;
MEALEXPENSE
13. printf("nnttt"WE WILL SERVE YOU:"Hi-Tea=100/-only"tt"Dinner=200/-
only"tt"Breakfast=100/-only"nn");
me=per*400;
MEALEXPENSE
te=(1100*per)+me;
TOTALEXPENSE
14. case 'P':
case 'p':
SERVICE
printf("nnttt"YOUR TICKET PRICE IS 1600/-"nn");
PERSONS
printf("nnttt"YOUR'S DESTINY DURATION IS 25 HOURS:"nn");
DEPARTURE
printf("nnttt"WE WILL SERVE YOU:Hi-Tea=100/-only"tt"Dinner=200/
only"tt"Breakfast=100/-only"tt"Lunch=200/-only"nn");
me=per*600;
MEALEXPENSE
te=(1600*per)+me;
TOTALEXPENSE