#include <stdio.h>
#include <math.h>
struct position
{
double latitude;
double longitude;
};
double computeDistance(const struct position *p1, const struct position *p2)
Type: Posts; User: ilikeapplepie
#include <stdio.h>
#include <math.h>
struct position
{
double latitude;
double longitude;
};
double computeDistance(const struct position *p1, const struct position *p2)
i copied and pasted your code. i was getting input error till. i removed commas from scanf then i got the big number.
visual c++ 2008 edition.
#include <stdio.h>
#include <math.h>
...
input
1 2 3 4
output
1726716016253713000000000000000000000000.000000000
yes, that worked no error. ty vry much. but now i am still getting a big number even with someone else's code.
something must be wrong with my compiler. i am really grateful for your help.
input :
1 2 3 4
output : input error
sorry, still no help.
i am a newbie i don't know what's wrong with my compiler. however, if the code works on your compiler at least i know i am on the right track.
#include <stdio.h>
#include <math.h>
struct position{
double latitude;
double longitude;
};
this is the slightly different new code.
#include <stdio.h>
#include <math.h>
struct position{
double latitude;
double longitude;
};
i am using visual studio 2008 i rebuilt, debugged and ran my program and i still get the same big number.
come to think of it, my calculation for the distance was initially wrong.
on x-coordinate...
that doesn't help either. i get another i think i should sleep now been awake all night and go through my logic. i think my formula for calculating the distance may be wrong as well. i really...
hmm, i added the pointers. now there is no error but i get a weird huge number like
92559631394.......
i am sorry i don't know why the indentation disappears.
i posted my code with the proper indentations.
#include <stdio.h>
#include <math.h>
struct position{
double latitude;
double longitude;
};
when i read directly into the member, i get an error - undeclared identifier.
also i need to scanf 4 values. so do i need %lf 4 times inside scanf function?
thanks.
i am not very knowledgeable on structures.
i want to input x1,y1 of one point and x2,y2 of other and get the distance.
this is my code but i am getting error.
#include <stdio.h>
#include...