Open RishabhRawat opened 8 years ago
A sample output of the code
1.VIEW ALL TRAINS
2.RESERVE A TICKET
3.CANCEL A TICKET
Enter your choice(1,2 or 3)2
Enter the train code1021
1.first class(fare Rs1500 )
2.second class(fare Rs1000)
3.sleeper class(fare Rs500)1
Enter number of tickets to be booked5
Your fare is Rs.2024084156
Enter the nameRisah
Enter the phone number9167520442
Enter the addressU-erec sd#
Number of ticketsYour ticket is confirmed
Here is your ticket
-----------------------------------------------------------------------------------------------
APOORVA'S RAILWAY NETWORK
Name: �
Phone Number: 6299796
Address: �
Tickets Booked: 6299852
HAVE A NICE JOURNEY!
-----------------------------------------------------------------------------------------------
@avroopa The warning messages
railway.c: In function ‘reserve’:
railway.c:65:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘int *’ [-Wformat=]
printf("Your fare is Rs.%d",&a);
^
railway.c:72:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘int *’ [-Wformat=]
printf("Your fare is Rs.%d",&a);
^
railway.c:78:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘int *’ [-Wformat=]
printf("Your fare is Rs.%d",&a);
^
railway.c:86:8: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[20]’ [-Wformat=]
scanf("%s",&s.name);
^
railway.c:90:8: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[50]’ [-Wformat=]
scanf("%s",&s.address);
^
railway.c:98:9: warning: format ‘%c’ expects argument of type ‘int’, but argument 2 has type ‘char (*)[20]’ [-Wformat=]
printf(" Name: %c \n",&s.name);
^
railway.c:99:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘int *’ [-Wformat=]
printf(" Phone Number: %d \n",&s.phno);
^
railway.c:100:9: warning: format ‘%c’ expects argument of type ‘int’, but argument 2 has type ‘char (*)[50]’ [-Wformat=]
printf(" Address: %c \n",&s.address);
^
railway.c:101:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘int *’ [-Wformat=]
printf(" Tickets Booked: %d \n",&s.ticketno);
^
test comment
Fails to compile, and check the warnings, I can see atleast 4-5 mistakes in warnings only, more in errors