int main(int argc, char *argv[]) { int i; int flights; // フライト数 int hour, min; // 指定時刻 hh:mm int dep, arr, n; // 出発地, 到着地, 表示数 FLIGHT *line; // 該当フライト参照ポインタ FLIGHT airline[40] = {0}; // フライト数が40までなら格納できる flights = read_airline(argv, argc-1, airline); printf("時刻を(hh:mm)の形式で入力してください >> "); scanf("%d:%d", &hour, &min); printf("出発地を選んでください (1:岡山, 2:羽田) >> "); scanf("%d", &dep); printf("到着地を選んでください (1:岡山, 2:羽田) >> "); scanf("%d", &arr); printf("表示数を入力してください [1-10] >> "); scanf("%d", &n); if (dep == arr || n < 1 || n > 10) { fprintf(stderr, "ERROR: Unexpected value was inputted.\n"); exit(EXIT_FAILURE); } for (i=0; i<n; i++) { line = search_flight(airline, hour, min, dep, arr); print_flight(line, i); if (line == NULL) break; hour = line->d_hour; min = line->d_min + 1; } return 0; }
void FlightCheck::finish() { if (takeoff_valid) { landing = previous; landing_valid = true; print_flight(); } }
void FlightCheck::fix(const IGCFix &fix) { if (!fix.gps_valid) return; if (previous_valid && fix.time > previous.time) { fixed distance = fix.location.Distance(previous.location); fixed speed = distance / (fix.time.GetSecondOfDay() - previous.time.GetSecondOfDay()); if (speed > fixed(15)) { if (fast_count == 0) fast = fix; ++fast_count; } else fast_count = 0; if (speed < fixed(5)) { if (slow_count == 0) slow = fix; ++slow_count; } else slow_count = 0; if (takeoff_valid) { if (slow_count > 10) { landing = slow; landing_valid = true; print_flight(); takeoff_valid = landing_valid = false; } } else { if (fast_count > 10) { takeoff = fast; takeoff_valid = true; } } } previous = fix; previous_valid = true; }