Q:

How to Convert Decimal coordinates to structured Coordinates in Delphi?

Hey there guys im working on a project for school and in the project it requires the user the enter decimal coordinates and convert it into structured format, ie:

17.428333°  -->   17° 25' 42" 

Does anyone possibly know how to do this? Also the program should be able to do it the opposite way; enter structured coordinates 17° 25' 42" and covert to decimal coordinates 17.4283333.  
I have got the basic maths used for the converting.  To convert from structured coordinates to decimal coordinates you can use the following :

17+25/60+42/3600

and to covert from decimal to structured takes first value 17 as the degrees then to work out the minutes 

17.4285-17=0.4285*60=25.71 

gets rid of the decimal or rounds the decimal to get the minutes, then to work out the seconds 

25.71-25=0.71*60=42.6  

either rounds the decimal or gets rid of the decimal for seconds.

A:

Let's assume you start with a coord in a floating point variable x. Calculate degrees, minutes and seconds like this:
Degrees := Trunc(x);
x := (x - Degrees)*60;
Minutes := Trunc(x);
x := (x - Minutes)*60
Seconds := Round(x);

The opposite direction is simpler. The expression you need is:
Degrees + Minutes/60 + Seconds/3600

