Sir what is the function for negative decimal? example -0.9292
----- Original Message ---- From: John Matthews <[EMAIL PROTECTED]> To: [email protected] Sent: Monday, August 18, 2008 9:54:25 PM Subject: [c-prog] Re: Question?? --- In [EMAIL PROTECTED] com, Jefferson Mendoza <jefferson_mendoza@ ...> wrote: > > Sir I've done it!! Thank You Very Much!!! > > I Will ask you later if i had encounter problems! Thank You again sir!!! Well done. FYI here is a version of the code you posted that uses a function to replace the code that gets the station location(?) from the user. You might not understand it yet, but it shows how functions can be very useful. BTW it is better not to use conio.h (gotoxy(), clrscr() etc.) because it is not standard C; your program would work ok without using the conio.h functions. typedef struct { double decimal_deg; double sec; } Pos_t; /* Function to get the position of a station. */ static void getStation(int x, int y, const char *station_name, Pos_t *pPos) { double deg; double min; double sec; gotoxy(x,y); printf("%s", station_name) ; gotoxy(x,y + 1);printf("Enter degrees: "); scanf("%lf", °); getchar(); /* getchar takes care of the line feed character */ gotoxy(x,y + 2);printf("Enter minutes: "); scanf("%lf", &min); getchar(); gotoxy(x,y + 3);printf("Enter seconds: "); scanf("%lf", &sec); getchar(); min /= (double)60; sec /= (double)3600; pPos->decimal_ deg = deg + min + sec; pPos->sec = pPos->decimal_ deg * 3600; gotoxy(x,y + 4);printf("Decimal Degrees: %lf ", pPos->decimal_ deg); gotoxy(x,y + 5);printf("Decimal Seconds: %.0f seconds", pPos->sec); } int main(void) { Pos_t LatE, LatW, LonW, LonE; int lat, logAm; float logBmAm; gotoxy(28,3) ;printf(" ENTER THE EXACT SITE LOCATION"); getStation(10, 5, "Latitude Station East", &LatE); getStation(10, 14, "Longitude Station East", &LonE); getStation(46, 5, "Latitude Station West", &LatW); getStation(46, 14, "Longitude Station West", &LonW); /* etc. */ [Non-text portions of this message have been removed]
