0% found this document useful (0 votes)
2K views9 pages

C' Program For Railway Ticket Reservation System

The document describes a C program for an online railway ticket reservation system. The program allows users to view train schedules and ticket prices, book tickets by entering passenger details, view reserved tickets, and search for tickets by ticket number. It uses structures to store passenger and ticket information. The program was developed using the Turbo C++ compiler on a PC running Windows. Key features of the program include menus to select operations, input of passenger and ticket data, and output of train schedules, booked tickets, and searched ticket details. Developing this program helped skills such as algorithm development, C programming, problem solving, and attention to detail. The program simulates real-world online railway ticket reservation systems.

Uploaded by

Prathamesh Kudav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views9 pages

C' Program For Railway Ticket Reservation System

The document describes a C program for an online railway ticket reservation system. The program allows users to view train schedules and ticket prices, book tickets by entering passenger details, view reserved tickets, and search for tickets by ticket number. It uses structures to store passenger and ticket information. The program was developed using the Turbo C++ compiler on a PC running Windows. Key features of the program include menus to select operations, input of passenger and ticket data, and output of train schedules, booked tickets, and searched ticket details. Developing this program helped skills such as algorithm development, C programming, problem solving, and attention to detail. The program simulates real-world online railway ticket reservation systems.

Uploaded by

Prathamesh Kudav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

REPORT

‘C’ PROGRAM FOR RAILWAY TICKET RESERVATION SYSTEM.

1.0 Rational
This program is based on the Online RAILWAY ticket reservation system using C-
Programming It accepts and display data of online railway ticket reservations.
2.0 Aim of micro Project:
Develop a C-program to accept and display records for online RAILWAY ticket
reservation system.

4.0 Course Outcome Address:


1) Develop Flowchart and Algorithm to solve problems logically.
2) Write simple C-program using arithmetic expression. 3) Develop
programs using control structure array and structures 4) Use functions
in C- program for modulus programming.

5.0 Literature Review:

6.0 Actual Methodology Followed:

1) Data Analysis
We have visited 4 to 5 Websites and collected sample of online Railway ticket
website by comparing all the sample we have finalized data:

• View train
• Book ticket
• View Reserved tickets
• Search ticket
• Exit
2) Algorithm:
• Case 1
Step1:-Start
Step2:- Define structure with member as name, gender,ticketno
Source, destination, price .

Step 3:-

• Case 2
Step1:Start.
Step2:Call to case 2.
Step3:Display Enter number of passengers.
Step4: Display Enter ticket details
Step5: Repeat step6 till i<num
Step6: Input and accept values for
variables.
Step7: Display passengers details entered
successfully.
Step8: Stop

• Case3
Step1:Start.
Step2: Call to case 3
Step3: Display ticket record.
Step4: Repeat step5 till i<num
Step5: Display all variables
increment I by 1
Go to step 4
Step6: Stop.

Case4:-
Step1:- Start
Step2:- Call to case 4
Step3:- Display Enter ticket no. To search.
Step4:- if (t[i].ticketno==tno)
Display all details and goto step5
Otherwise
Increment i by 1
Go to step4
else
Display entered ticket number is invalid
Case5:-
Step1:- Start
Step2:- Call to Case5
Step3:- Display do you want to exit
Step4:- if(ex=='y')

3) Implementation :
Program:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
struct ticket
{
char name[10];
char gender[10];
int ticketno;
char source[10];
char destination[10];
int price;
};
void main()
{
char username[10];
int password;
struct ticket t[5];
int i,us,pa,ch,tno,ex,num;
clrscr();
printf("**********Railway Ticket Reservation********\n");
printf("\n\t Enter the username:");
scanf("%s",&us);
printf("\n\t Enter the password:");
scanf("%d",&pa);
if(us=='a')
{
if(pa==12345)
{
clrscr();
printf("Logged in Successfully!!\n");
do
{
printf("\n\t\t\t *****Menu*****");
printf("\n 1.View Train \n 2.Book Ticket \n 3.View Reserved Tickets \n 4.Search Ticket \n 5.Exit");
printf("\n Enter your choice:");
scanf("%d",&ch);
switch(ch)
{
case 1:
printf("***********View Train************\n");
printf("\n--------------------------------------------------------------------------------");
printf("\n Train \t\t\tSource&Destinations \tcharges \t\tTime");
printf("\n--------------------------------------------------------------------------------");
printf("\nFast Train \tThane to CSMT \tRs.20 \t\t09:05 AM");
printf("\nSlow Train \tThane to CSMT \tRs.30 \t\t09:20 AM");
printf("\nExpress Train \tKalyan to Chennai \tRs.50 \t\t12:12 AM");
printf("\nRajdhani Express\tMumbai to Gujarat \tRs.1000 \t\t01:30 AM");
printf("\nSlow Train \tParel to Thane \tRs.20 \t\t01:45 AM");
break;
case 2:
printf("\n Enter the number of passengers:");
scanf("%d",&num);
printf("\n\t\t**** Enter ticket details****");
for(i=0;i<num;i++)
{
printf("\n Enter name:");
scanf("%s",&t[i].name);
printf("\n Enter gender:");
scanf("%s",&t[i].gender);
printf("\n Enter ticketno:");
scanf("%d",&t[i].ticketno);
printf("\n Enter source:");
scanf("%s",&t[i].source);
printf("\n Enter destination:");
scanf("%s",&t[i].destination);
printf("\n Enter price:");
scanf("%d",&t[i].price);
}
printf("\n Passenger details entered succesfully.");
break;
case 3:
printf("\n\t\t**** Ticket record***");
printf("\nName \tGender \t\t Ticket no \tSource \t\tDestination");
for(i=0;i<num;i++)
{
printf("\n%-12s",t[i].name);
printf("%-15s",t[i].gender);
printf("%-12d",t[i].ticketno);
printf("%-15s",t[i].source);
printf("%-30s",t[i].destination);
}
break;
case 4:
printf("\t\t******Search Ticket*****\n");
printf("\n Enter ticket no to search:");
scanf("%d",&tno);
for(i=0;i<5;i++)
{
if(t[i].ticketno==tno)
{
printf("\n\t Ticketno=%d",t[i].ticketno);
printf("\n\t Name=%s",t[i].name);
printf("\n\t Gender=%s",t[i].gender);
printf("\n\t source=%s",t[i].source);
printf("\n\t Destination=%s",t[i].destination);
printf("\n\t Price=%d",t[i].price);
}
else{
printf("\n\t Entered Ticket number is invalid\n");
break;
}
}
break;
case 5:
printf("Do you want to exit:(y/n)");
scanf("%s",&ex);
if(ex=='y')
{
exit(0);
}
else{
break;
}
default:
printf("\n Invalid choice");
}
printf("\n Do you want to continue:(1/2)");
scanf("%d",&ch);
}
while(ch==1);
}
else
{
printf("\n Incorrect password. Please try again");
}
}
else
{
printf("\n Incorrect username. Please try again");
}
getch();
}

7.0 Actual Resources Used:

Sr no Resources Specifications Quantity Remark


1
1. PC Intel(R)core(TM
) i57400CPU @
3.00GHz
2. Turbo C++ - 1

3. Notes - 1

8.0 Output of Micro project :


**********Railway Ticket Reservation********

Enter the username:a

Enter the password:12345

*************MENU*************
1.View Train
2.Book Ticket
3.View Reserved Tickets
4.Search Ticket
5.Exit
Enter your choice:1
***********View Train************

--------------------------------------------------------------------------------
Train Source&Destinations charges Time
--------------------------------------------------------------------------------
Fast Train Thane to CSMT Rs.20 09:05 AM
Slow Train Thane to CSMT Rs.30 09:20 AM
Express Train Kalyan to Chennai Rs.50 12:12 AM
Rajdhani Express Mumbai to Gujarat Rs.1000 01:30 AM
Slow Train Parel to Thane Rs.20 01:45 AM
Do you want to continue:(1/2)1
*************MENU*************
1.View Train
2.Book Ticket
3.View Reserved Tickets
4.Search Ticket
5.Exit
Enter your choice:2
Enter the number of passengers:2

*** Enter ticket details*****


Enter name:Omkar

Enter gender:male

Enter ticketno:3

Enter source:kalyan

Enter destination:nerul

Enter price:89

Enter name:Ruchita

Enter gender:Female

Enter ticketno:76

Enter source:Kalva

Enter destination:thane

Enter price:70

Passenger details entered succesfully.


Do you want to continue:(1/2)1
****Menu*****
1.View Train
2.Book Ticket
3.View Reserved Tickets
4.Search Ticket
5.Exit
Enter your choice:3

*** Ticket record****


Name Gender Ticket no Source Destination
Omkar male 3 kalyan nerul
Ruchita Female 76 Kalva thane
Do you want to continue:(1/2)1
[22:51, 4/20/2023] Omkar Kudav: *****Menu*****
1.View Train
2.Book Ticket
3.View Reserved Tickets
4.Search Ticket
5.Exit
Enter your choice:4
******Search Ticket*****

Enter ticket no to search:3

Ticketno=3
Name=Omkar
Gender=male
source=kalyan
Destination=nerul
Price=89
Entered Ticket number is invalid

Do you want to continue:(1/2)


**********MENU********
1.View Train
2.Book Ticket
3.View Reserved Tickets
4.Search Ticket
5.Exit
Enter your choice:4
******Search Ticket*****

Enter ticket no to search:89

Entered Ticket number is invalid

Do you want to continue:(1/2)1


*****Menu*****
1.View Train
2.Book Ticket
3.View Reserved Tickets
4.Search Ticket
5.Exit
Enter your choice:5
Do you want to exit:(y/n)y
9.0 Skills Develop/Learning Outcome of micro project
• Able to develop a flowchart.
• Team Co ordination
• Able to write an algorithm.
• Innovative thinking.
• Able to develop c program using expression.
• Attention to detail.
• Able to develop programs using structure and array.
• Problem solving skills.

10.0 Application of this micro project:

Our application is used in real time ticket reservation in different Railway ticket
reservation websites such as IRCTC, Make my trip, Railyatri etc.

You might also like