qb45advr.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
.cintx
:nCINT 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