0% found this document useful (0 votes)
15 views2 pages

Project

Uploaded by

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

Project

Uploaded by

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

#include <stdio.

h>

struct Train
{
char train_name[100];
int train_number;
char departure_station[50];
char arrival_station[50];
int total_seats;
int booked_seats;
};

struct Passenger
{
char name[50];
int passenger_id;
int booked_train_number;
int seat_number;
};

int new_train (struct Train *tr) {


printf("Enter train name:");
scanf("%s", tr->train_name);
printf("Enter train number:");
scanf("%d", &tr->train_number);
printf("Enter departure station:");
scanf("%s", tr->departure_station);
printf("Enter arrival station:");
scanf("%s", tr->arrival_station);
printf("Enter total seats:");
scanf("%d", &tr->total_seats);

printf("\nTrain added Successfully!");


return 0;
}

int main() {
int choice;

printf("Railway Managment System\n");


printf ("1.Add New Train\n");
printf ("2.Register New Passenger\n");
printf ("3.Book a Ticket\n");
printf ("4.Cancel a Ticket\n");
printf ("5.Search for Trains\n");
printf ("6.Display Train Schedule\n");
printf ("7.Save Data to File\n");
printf ("8.Load Data from File\n");
printf ("9.View Booking Statistics\n");
printf ("10.Exit\n");
scanf ("%d", &choice);

int i = 0;
struct Train trains[100];

switch (choice) {
case 1:
if (i<100) {
new_train (&trains[i]);
i++;
}
else
printf("Trains limit exceeded,cannot add more train");

break;

case 2:

break;

case 3:

break;

case 4:

break;

case 5:

break;

case 6:

break;

case 7:

break;

case 8:

break;

case 9:

break;

case 10:

break;

default:
printf("Invalid choice. Please try again.\n");

return 0;
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy