C Program to display the steps to get the train ticket manually | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

C Program to display the steps to get the train ticket manually

C Program to display the steps to get the train ticket manually with algorithm

1st Aug 2018, 6:47 PM
Shreeda Bhat
Shreeda Bhat - avatar
1 Answer
+ 5
for this u need to prepare a structure suppose "ticket" now u should hv some structure elements so lets take ticket number, seat number, seat type, destination to reach, other will be charges of train. now make 2 function inside the structure(called as structure functions) one will cin/gets the required above information, other one will show it. lets make the above structure.... struct ticket { long ticketno; long seatno; char seattype; char destination[20]; double charges; void enter() { //cin the structure elements } void display() { //cout the structure elements } };//end of the structure void main (){ ticket t1,t[10];//suppose one variable & an array t1.enter (); t1.display(); for(int i=0;i <10;i++)//loop to enter the array t[i].enter (); for( i=0;i <10;i++)//loop to show the array t [i].display (); } if u got any problem in this code plz let me know....u know this will work on the .cpp extension...but the code is correct.
2nd Aug 2018, 10:00 AM
MOHAN👨🏻‍💻
MOHAN👨🏻‍💻 - avatar