DEGRES CONVERSION

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
LEGRAND
Coder
Posts: 49
Joined: Wed Jul 30, 2008 7:57 am

DEGRES CONVERSION

Post by LEGRAND »

I have difficulties to transform DEGRES as used in programs (DD.MMSS)
DD=DEGRES, MM=MINUTES etc; 24DEG 45MN 30S = 24.4530 as input
in DECIMAL notation (24. 75833)
I know it's elementary but for some reason I cannot find the actual number. I suppose that the code (3 lines) exists somewhere.I didn't find it.Could Somebody be kind enough to help me?
Thanks in advance.
lrcvs
Veteran
Posts: 58
Joined: Mon Mar 10, 2008 9:28 am

Post by lrcvs »

It is easy to translate 24 Deg, 45 Min, 30 seconds to Value Decimal
1 Dgr = 60 Min
1 Min = 60 Sec

Then:

24 * 60 * 60 = DSec
45 * 60 = MSec
30 sec = SSec

Total value decimal in Sec = DSec + MSec + SSec

1 Dgr Decimal = 3600 Sec

Dgr = ( Total Value in Sec) / 3600

Greetings
LEGRAND
Coder
Posts: 49
Joined: Wed Jul 30, 2008 7:57 am

DEGRES TO DECIMAL

Post by LEGRAND »

Thanks.
Post Reply