qb45advr.hlp (Topic list)
CINT Function Programming Example
  QuickSCREEN      Details     Example      Contents      Index
──────────────────────────────────────────────────────────────────────────────
CINT Function Programming Example
 
The following example converts an angle in radians to an angle in
degrees and minutes:
 
'Set up constants for converting radians to degrees.
CONST PI=3.141593, RADTODEG=180./PI
INPUT "Angle in radians = ",Angle  'Get the angle in radians.
Angle = Angle * RADTODEG    'Convert radian input to degrees.
Min = Angle - INT(Angle)    'Get the fractional part.
'Convert fraction to value between 0 and 60.
Min = CINT(Min * 60)
Angle = INT(Angle)          'Get whole number part.
IF Min = 60 THEN       '60 minutes = 1 degree.
   Angle = Angle + 1
   Min = 0
END IF
PRINT "Angle equals" Angle "degrees" Min "minutes"
 
Sample Output
 
Angle in radians = 1.5708
Angle equals 90 degrees 0 minutes