I am getting the following error when compiling the code below:
(111): error C2296: '^' : illegal, left operand has type 'double'
(111): error C2297: '^' : illegal, right operand has type 'double'
(112): error C2144: syntax error : 'double' should be preceded by ';'
The lines are the two using trig functions. I looked at the sin function in the Reference pages and tried using "double sin" but that didn't work. I am using MS Visual Studio Express 2010. Are my variables wrong or is my syntax wrong?
If I remember correctly C++ doesn't support using '^' for raising numbers to a power, it is used for bitwise calculations. Try using the pow function instead (inside of cmath)
pow( (sin(deltaLat/2)), 2 )
Assuming you actually meant them to be raised to a power?
The 3rd error is just you forgot a semi colon at the end of the statement.