-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflightUtils.h
68 lines (55 loc) · 1.75 KB
/
flightUtils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#pragma warning(disable:4996)
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include "airPortUtils.h"
#include "airportManagerUtils.h"
#include "ArraylistUtils.h"
#ifndef __Flight
#define __Flight
struct Airport;
typedef struct flights {
Airport* flyFrom;
Airport* flyTo;
char *dateOfTakeoff; // dd/mm/yyyy + \0 , len=11
int hourOfTakeoff;
float fligthVelocity; // MPH
} Flight;
#endif
#ifndef __AirportManager
#define __AirportManager
struct Airport;
typedef struct airportManagers {
Airport* allAirports; // array of airports, not pointers to airport
int arrPsclSize;
int allAirportsCount;
} AirportManager;
#endif
#ifndef __Airport
#define __Airport
typedef struct airports {
char* name;
char* country;
char* IATAcode;
float latitude;
float longitude;
} Airport;
#endif
#ifndef __FlightUtils
#define __FlightUtils
float CalcfligthTime(const Flight* flight1);
int isFlightFromAtoB(Flight* f1, char* flyFrom, char* flyTo);
Flight* manuallyCreateNewFlight(const AirportManager* airportDB);
char* setIATAofFlight(const AirportManager* airportDB);
void printFlightDetails(Flight* f1);
Flight* automaticllyCreateNewFlight(char* depIATA, char* arrIATA,
char* dateOfTakeOff, int hourOfTakeOff, float flightVelocity, const AirportManager* airportDB);
void freeFlight(Flight* f1);
int countFlightsFromAtoB(arraylist* flightsPtrArr, char* flyFromA, char* flyToB);
void writeFlightToBinaryFile(Flight* flight1, FILE* file1);
void makeFictitiousFlight(char* dateOfTakeOff, int hourOfTakeOff, float flightVelocity, Flight* f1);
void readFlightFromBinaryFile(FILE* file1, Flight* flight1, AirportManager* airportDB);
void freeFlight_Void(void* freeMe);
void printFlightDetails_void(void* f1);
void copyFlight(const Flight* src, Flight* dest);
#endif