type 'double' unexpected

hey i got some c homework due Monday and I'm stuck. please help me. I'm going to mark the error lines with **** in place of a tab. debug errors are at the bottom. i will be eternally grateful for any insight.


//patrick allard
//program4
//prof ed ryder
#include "stdio.h"
#include "stdlib.h"
#include "math.h"
void main()
{
//declare input variables
double lat1, lat2, lat3, long1, long2, long3;
//aquire input values from user
printf("\nEnter position of way point 1 \(latitude and longitude\)\: ");
scanf("%lf %lf", &lat1, &long1);
printf("\nEnter position of way point 2 \(latitude and longitude\)\: ");
scanf("%lf %lf", &lat2, &long2);
//convert degrees to radians
lat1=lat1*.017453;
lat2=lat2*.017453;
long1=long1*.017453;
long2=long2*.017453;
//make suure difflat and difflong are within domain of function cos
double difflat1=fabs(lat1-lat2);
double difflong1=fabs(long1-long2);
while (difflat1>6.2832)
{
difflat1=difflat1-6.2832;
}
while (difflong1>6.2832)
{
difflong1=difflong1-6.2832;
}
//makesure asineparam is within the domain of function asin
double asinparam1=sqrt(fabs(1.0-.5*cos(difflat1)-.5*cos(difflong1)));
while (asinparam1>1)
{
asinparam1=asinparam1-2;
}
//declare and assign distance output variable
double d1=asin(asinparam1)*2.0*3963.1;
//display desired output
printf("\nDistance traveled =%6.1lf miles", d1);
double pathd=d1;

do{
//aquire input values from user
printf("\nEnter position of way point 3 \(latitude and longitude\)\: ");
scanf("%lf %lf", &lat3, &long3);
//how to break the loop
if (lat3=EOF)
{
break;
}

if (long3=EOF)
{
break;
}
//convert degrees to radians
double lat3=lat3*.017453;
double long3=long3*.017453;
//make suure difflat and difflong are within domain of function cos
double difflat2=fabs(lat2-lat3);
double difflong2=fabs(long2-long3);
while (difflat2>6.2832)
{
difflat2=difflat2-6.2832;
}
while (difflong2>6.2832)
{
difflong2=difflong2-6.2832;
};
//makesure asineparam is within the domain of function asin
double asinparam2=sqrt(fabs(1.0-.5*cos(difflat2)-.5*cos(difflong2)));
while (asinparam2>1)
{
asinparam2=asinparam2-2;
}
//declare and assign distance output variable
double d2=asin(asinparam2)*2.0*3963.1;
pathd=pathd+d2;
//display desired output
printf("\nDistance traveled =%6.1lf miles", pathd);
}



//make suure difflat and difflong are within domain of function cos
****double difflatt=fabs(lat1-lat3);
****double difflongt=fabs(long1-long3);
****while (difflatt>6.2832)
{
difflatt=difflatt-6.2832;
}
while (difflongt>6.2832)
{
difflongt=difflongt-6.2832;
}
//makesure asineparam is within the domain of function asin
double asinparamt=sqrt(fabs(1.0-.5*cos(difflatt)-.5*cos(difflongt)));
while (asinparamt>1)
{
asinparamt=asinparamt-2;
}
//declare and assign distance output variable
double dt=asin(asinparamt)*2.0*3963.1;




//display desired output
printf("\n\n Total Distance traveled =%6.1lf miles\nStart to finish distance =%6.1lf miles", pathd, dt);
}








C:\Documents and Settings\Luigi Mario\Desktop\patrick allard gps2 source.cpp(88) : error C2062: type 'double' unexpected
C:\Documents and Settings\Luigi Mario\Desktop\patrick allard gps2 source.cpp(90) : error C2065: 'difflatt' : undeclared identifier
C:\Documents and Settings\Luigi Mario\Desktop\patrick allard gps2 source.cpp(92) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
sorry that was messy let me try the insert code button\

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

//patrick allard
//program4
//prof ed ryder
#include "stdio.h"
#include "stdlib.h"
#include "math.h"
void main()
{
//declare input variables
    double lat1, lat2, lat3, long1, long2, long3;
//aquire input values from user
    printf("\nEnter position of way point 1 \(latitude and longitude\)\: ");
    scanf("%lf %lf", &lat1, &long1);
    printf("\nEnter position of way point 2 \(latitude and longitude\)\: ");
    scanf("%lf %lf", &lat2, &long2);
//convert degrees to radians
    lat1=lat1*.017453;
    lat2=lat2*.017453;
    long1=long1*.017453;
    long2=long2*.017453;
//make suure difflat and difflong are within domain of function cos
****    double difflat1=fabs(lat1-lat2);
****    double difflong1=fabs(long1-long2);
    while (difflat1>6.2832)
    {
****[code]
difflat1=difflat1-6.2832;
}
while (difflong1>6.2832)
{
difflong1=difflong1-6.2832;
}
//makesure asineparam is within the domain of function asin
double asinparam1=sqrt(fabs(1.0-.5*cos(difflat1)-.5*cos(difflong1)));
while (asinparam1>1)
{
asinparam1=asinparam1-2;
}
//declare and assign distance output variable
double d1=asin(asinparam1)*2.0*3963.1;
//display desired output
printf("\nDistance traveled =%6.1lf miles", d1);
double pathd=d1;

do{
//aquire input values from user
printf("\nEnter position of way point 3 \(latitude and longitude\)\: ");
scanf("%lf %lf", &lat3, &long3);
//how to break the loop
if (lat3=EOF)
{
break;
}

if (long3=EOF)
{
break;
}
//convert degrees to radians
double lat3=lat3*.017453;
double long3=long3*.017453;
//make suure difflat and difflong are within domain of function cos
double difflat2=fabs(lat2-lat3);
double difflong2=fabs(long2-long3);
while (difflat2>6.2832)
{
difflat2=difflat2-6.2832;
}
while (difflong2>6.2832)
{
difflong2=difflong2-6.2832;
};
//makesure asineparam is within the domain of function asin
double asinparam2=sqrt(fabs(1.0-.5*cos(difflat2)-.5*cos(difflong2)));
while (asinparam2>1)
{
asinparam2=asinparam2-2;
}
//declare and assign distance output variable
double d2=asin(asinparam2)*2.0*3963.1;
pathd=pathd+d2;
//display desired output
printf("\nDistance traveled =%6.1lf miles", pathd);
}



//make suure difflat and difflong are within domain of function cos
double difflatt=fabs(lat1-lat3);
double difflongt=fabs(long1-long3);
while (difflatt>6.2832)
{
difflatt=difflatt-6.2832;
}
while (difflongt>6.2832)
{
difflongt=difflongt-6.2832;
}
//makesure asineparam is within the domain of function asin
double asinparamt=sqrt(fabs(1.0-.5*cos(difflatt)-.5*cos(difflongt)));
while (asinparamt>1)
{
asinparamt=asinparamt-2;
}
//declare and assign distance output variable
double dt=asin(asinparamt)*2.0*3963.1;




//display desired output
printf("\n\n Total Distance traveled =%6.1lf miles\nStart to finish distance =%6.1lf miles", pathd, dt);
}


[/code]
ok one more try

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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114

//patrick allard
//program4
//prof ed ryder
#include "stdio.h"
#include "stdlib.h"
#include "math.h"
void main()
{
//declare input variables
    double lat1, lat2, lat3, long1, long2, long3;
//aquire input values from user
    printf("\nEnter position of way point 1 \(latitude and longitude\)\: ");
    scanf("%lf %lf", &lat1, &long1);
    printf("\nEnter position of way point 2 \(latitude and longitude\)\: ");
    scanf("%lf %lf", &lat2, &long2);
//convert degrees to radians
    lat1=lat1*.017453;
    lat2=lat2*.017453;
    long1=long1*.017453;
    long2=long2*.017453;
//make suure difflat and difflong are within domain of function cos
    double difflat1=fabs(lat1-lat2);
    double difflong1=fabs(long1-long2);
    while (difflat1>6.2832)
    {
        difflat1=difflat1-6.2832;
    }
    while (difflong1>6.2832)
    {
        difflong1=difflong1-6.2832;
    }
//makesure asineparam is within the domain of function asin
    double asinparam1=sqrt(fabs(1.0-.5*cos(difflat1)-.5*cos(difflong1)));
    while (asinparam1>1)
    {
        asinparam1=asinparam1-2;
    }
//declare and assign distance output variable
    double d1=asin(asinparam1)*2.0*3963.1;
//display desired output
    printf("\nDistance traveled =%6.1lf miles", d1);
	double pathd=d1;

	do{
//aquire input values from user
		printf("\nEnter position of way point 3 \(latitude and longitude\)\: ");
		scanf("%lf %lf", &lat3, &long3);
//how to break the loop
		if (lat3=EOF)
		{
			break;
		}
		
		if (long3=EOF)
		{
			break;
		}
//convert degrees to radians
		double lat3=lat3*.017453;
		double long3=long3*.017453;
//make suure difflat and difflong are within domain of function cos
		double difflat2=fabs(lat2-lat3);
		double difflong2=fabs(long2-long3);
		while (difflat2>6.2832)
		{
		    difflat2=difflat2-6.2832;
		}
		while (difflong2>6.2832)
		{
			difflong2=difflong2-6.2832;
		};
//makesure asineparam is within the domain of function asin
		double asinparam2=sqrt(fabs(1.0-.5*cos(difflat2)-.5*cos(difflong2)));
		while (asinparam2>1)
		{
			asinparam2=asinparam2-2;
		}
//declare and assign distance output variable
		double d2=asin(asinparam2)*2.0*3963.1;
		pathd=pathd+d2;
//display desired output
		printf("\nDistance traveled =%6.1lf miles", pathd);
	}



//make suure difflat and difflong are within domain of function cos
****double difflatt=fabs(lat1-lat3);
    double difflongt=fabs(long1-long3);
****while (difflatt>6.2832)
    {
****difflatt=difflatt-6.2832;
    }
    while (difflongt>6.2832)
    {
        difflongt=difflongt-6.2832;
    }
//makesure asineparam is within the domain of function asin
    double asinparamt=sqrt(fabs(1.0-.5*cos(difflatt)-.5*cos(difflongt)));
    while (asinparamt>1)
    {
        asinparamt=asinparamt-2;
    }
//declare and assign distance output variable
    double dt=asin(asinparamt)*2.0*3963.1;




//display desired output
    printf("\n\n Total Distance traveled =%6.1lf miles\nStart to finish distance =%6.1lf miles", pathd, dt);
}


C:\Documents and Settings\Luigi Mario\Desktop\patrick allard gps2 source.cpp(88) : error C2062: type 'double' unexpected
C:\Documents and Settings\Luigi Mario\Desktop\patrick allard gps2 source.cpp(90) : error C2065: 'difflatt' : undeclared identifier
C:\Documents and Settings\Luigi Mario\Desktop\patrick allard gps2 source.cpp(92) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
i tried putting while (1==1) AFTER THE CTRL Z DO loop, and it gets rid of the errors when i compile, but they reappear when i build.

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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115

//patrick allard
//program4
//prof ed ryder
#include "stdio.h"
#include "stdlib.h"
#include "math.h"
void main()
{
//declare input variables
    double lat1, lat2, lat3, long1, long2, long3;
//aquire input values from user
    printf("\nEnter position of way point 1 \(latitude and longitude\)\: ");
    scanf("%lf %lf", &lat1, &long1);
    printf("\nEnter position of way point 2 \(latitude and longitude\)\: ");
    scanf("%lf %lf", &lat2, &long2);
//convert degrees to radians
    lat1=lat1*.017453;
    lat2=lat2*.017453;
    long1=long1*.017453;
    long2=long2*.017453;
//make suure difflat and difflong are within domain of function cos
    double difflat1=fabs(lat1-lat2);
    double difflong1=fabs(long1-long2);
    while (difflat1>6.2832)
    {
        difflat1=difflat1-6.2832;
    }
    while (difflong1>6.2832)
    {
        difflong1=difflong1-6.2832;
    }
//makesure asineparam is within the domain of function asin
    double asinparam1=sqrt(fabs(1.0-.5*cos(difflat1)-.5*cos(difflong1)));
    while (asinparam1>1)
    {
        asinparam1=asinparam1-2;
    }
//declare and assign distance output variable
    double d1=asin(asinparam1)*2.0*3963.1;
//display desired output
    printf("\nDistance traveled =%6.1lf miles", d1);
	double pathd=d1;

	do{
//aquire input values from user
		printf("\nEnter position of way point 3 \(latitude and longitude\)\: ");
		scanf("%lf %lf", &lat3, &long3);
//how to break the loop
		if (lat3=EOF)
		{
			break;
		}
		
		if (long3=EOF)
		{
			break;
		}
//convert degrees to radians
		double lat3=lat3*.017453;
		double long3=long3*.017453;
//make suure difflat and difflong are within domain of function cos
		double difflat2=fabs(lat2-lat3);
		double difflong2=fabs(long2-long3);
		while (difflat2>6.2832)
		{
		    difflat2=difflat2-6.2832;
		}
		while (difflong2>6.2832)
		{
			difflong2=difflong2-6.2832;
		};
//makesure asineparam is within the domain of function asin
		double asinparam2=sqrt(fabs(1.0-.5*cos(difflat2)-.5*cos(difflong2)));
		while (asinparam2>1)
		{
			asinparam2=asinparam2-2;
		}
//declare and assign distance output variable
		double d2=asin(asinparam2)*2.0*3963.1;
		pathd=pathd+d2;
//display desired output
		printf("\nDistance traveled =%6.1lf miles", pathd);
	}
	while (1==1);


//make suure difflat and difflong are within domain of function cos
    double difflatt=fabs(lat1-lat3);
    double difflongt=fabs(long1-long3);
    while (difflatt>6.2832)
    {
        difflatt=difflatt-6.2832;
    }
    while (difflongt>6.2832)
    {
        difflongt=difflongt-6.2832;
    }
//makesure asineparam is within the domain of function asin
    double asinparamt=sqrt(fabs(1.0-.5*cos(difflatt)-.5*cos(difflongt)));
    while (asinparamt>1)
    {
        asinparamt=asinparamt-2;
    }
//declare and assign distance output variable
    double dt=asin(asinparamt)*2.0*3963.1;




//display desired output
    printf("\n\n Total Distance traveled =%6.1lf miles\nStart to finish distance =%6.1lf miles", pathd, dt);
}




C:\Documents and Settings\Luigi Mario\Desktop\patrick allard gps continued source[1].cpp(88) : error C2062: type 'double' unexpected
C:\Documents and Settings\Luigi Mario\Desktop\patrick allard gps continued source[1].cpp(90) : error C2065: 'difflatt' : undeclared identifier
C:\Documents and Settings\Luigi Mario\Desktop\patrick allard gps continued source[1].cpp(92) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
Topic archived. No new replies allowed.