I am coding a simple Railway reservation system.
I don't know what should I write to take input from user about "Name" and respective "Ages" of Passengers.
I am a beginner also, but I dont think you should be calling the two functions on line 21 and line 22 as you are calling them in main from the railway object.
Comment out line 21 and line 22 and then run your program
Can you please tell me what should I use to store the names of Passengers ?
You could use separate arrays for age and name, like this:
1 2
int age[100];
char pname[100][30];
or alternatively, define a separate class called person or passenger which will store the age and name, and then use an array of passengers inside the railway class.