Typedef & main help

I need help trying to finish this code, So i'm suppose to ask the user the ground speed, the information (lat long) for airport 1, airport 2, airport 3 and calculate the distance for each trip. (for example the distance between airport 1 and airport 2 the total flight time, then the distance between airport 2 and aiport 3, and it's total flight time). then i need to print out the itinerary with the distance and flight times.

Basically I need help with the "user input" and "Calculations" Part any help is much appreciated. Thanks- mike

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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93

#include "stdafx.h"
#include <string.h>
#include <math.h>
#define PI 3.14159          /* defines PI, Constant radius of earth, and Converts Degrees into Radians*/
#define R (10800 / PI)
#define ToRad (PI / 180)
#define C_ID 4
#define Ports 3

//readline
void readLine(char* Array){
    char temp;
    int index = 0;
    do{
        scanf("%c", &temp);
        if (temp != 10 && temp != 13){
            Array[index] = temp;
            index++;
            
        }
    } while ((temp != 10 && temp != 13) || index == 0);
    Array[index] = '\0';
}

//method
double Conversion(double Lat1, double Long1, double Lat2, double Long2);

typedef class {
public:
    // Fields :
    char ID[C_ID];
    double Lat, Long, Elev;
    
    //Conversion to Radians
    double getDistance(double Lat1, double Long1, double Lat2, double Long2){
        double V, Distance1;
        Lat1 = ToRad * Lat1;
        Long1 = ToRad * Long1; /* converts users input into radians*/
        Lat2 = ToRad * Lat2;
        Long2 = ToRad * Long2;
        V = acos(sin(Lat1) * sin(Lat2) + cos(Lat1) * cos(Lat2) * cos(Long1 - Long2));
        Distance1 = (V * R);
        return Distance1;
    }
    // Mutators :
    double getDistance(double Latitude, double Longitude){
        double Distance;
        Distance = getDistance(Lat, Long, Latitude, Longitude);  //Calls back to getDistance method
        return Distance;
    }
    double getDisance(void *Destination){
        
        double ret = getDistance(((Airport*)Destination)->Lat, ((Airport*)Destination)->Long); 
        return ret;
    }
}Airport;



int main(int argc, const char * argv[]) {
   
    //Variable Declaration
    Airport Info[Ports];
    char ID[C_ID];
    int groundSpeed;
    double Lat, Long;
    
    //User Input
    printf("What is the Ground speed? > ");
    scanf("%d", &groundSpeed);
    for(int i = 1; i > 1; i++){
        printf("Enter Airport ID > ");
        readLine(ID);
        printf("Enter Latitude > ");
        scanf("%lf",Lat);
        printf("Enter Longitude > ");
        scanf("%lf", Long);
        strcpy(ID,
        Info[i-1].Lat = Lat;
        Info[i-1].Long = Long;
    }
    
    
    //Calculations


    //Output
    
    
    
    return 0;
}
Topic archived. No new replies allowed.