Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void addFlight(int flight_counter){
- int fcl = 1, dl = 1, i;
- while(fcl){
- i = 0;
- char temp[MAX_FLIGHTCODE_LENGTH];
- printf("Enter flight code>\n");
- scanf(" %[^\n]s", temp);
- for(i = 0; i <= MAX_FLIGHTCODE_LENGTH; i++){
- if(i < 2 && temp[i] >= 'A' && temp[i] <= 'Z'){
- flights[flight_counter].flightcode[i] = temp[i];
- }
- else if(i >= 2 && temp[i] >= '0' && temp[i] <= '9'){
- flights[flight_counter].flightcode[i] = temp[i];
- }
- else if((temp[i] == '\0' || temp[i] == '\n') && i != 2){
- fcl = 0;
- }
- else{
- printf("Invalid input\n");
- for(i = 0; i <= MAX_FLIGHTCODE_LENGTH; i++){
- temp[i] = '\0';
- }
- fcl = 1;
- }
- }
- }
- while(dl){
- struct dt_temp{
- int month;
- int day;
- int hour;
- int minute;
- };
- typedef struct dt_temp dt_temp_t;
- printf("Enter departure info for the flight leaving SYD.\n");
- printf("Enter month, date, hour and minute separated by spaces>\n");
- scanf(" %d", &flights[flight_counter].departure_dt.month);
- scanf(" %d", &flights[flight_counter].departure_dt.day);
- scanf(" %d", &flights[flight_counter].departure_dt.hour);
- scanf(" %d", &flights[flight_counter].departure_dt.minute);
- printf("%d %d %d %d\n", flights[flight_counter].departure_dt.month, flights[flight_counter].departure_dt.day, flights[flight_counter].departure_dt.hour, flights[flight_counter].departure_dt.minute);
- if(dt_temp_t.month > 0 && dt_temp_t.month <= 12){
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement