I am working on a program that requires a nested structure to store a departure date (day, month, year) and have declared it as such:-
I sort of understand the concept of nested structures and how to access structure members but in my program I don't set 'departure date' values I accept user input. I am unsure on how to store the user input. All references I have checked seem to initialise values for nested structures. I would like to ask the user only to enter one 'departure date' comprising of day, month and year as opposed to entering all three seperately. I thought the following code was correct:-Code:struct departDate{ int day; int month; int year; }; struct flightDetails{ String flightNo; String departAirport; String arriveAirport; departDate date; String departTime; int seats; int reserved; double price; }; const int listSize = 30; //number of records in array int currentSize = 0;
but since I am having problems displaying my records on screen (fomatting of) I cannot check if this is correct.Code:cout<<"Enter departure date:"; cin>>flightList[currentSize].date.day>>flightList [currentSize].date.month>>flightList [currentSize].date.year;
Its one problem after another for us programming newbies!!
Any help would be gratefully appreciated



LinkBack URL
About LinkBacks



