* *
*
* * News
 • Daily news
 • Archived news

Columns
 • WildCard
 • Qbasic Articles
 • QB Comic!

Learning center
 • QB Books
 • Qbasic Lessons!
 • Qbasic FAQ
 • Newbies Section
 • Qbasic Tutorials

* *
*
*
*
*  
.TAN Function Programming Example.

  QuickSCREEN      Details     Example      Contents      Index
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
TAN Function Programming Example
The following example computes the height of an object using the distance
from the object and the angle of elevation. The program draws the triangle
produced by the base and the computed height.
 
SCREEN 2
 
INPUT "LENGTH OF BASE: ",Baselen
INPUT "ANGLE OF ELEVATION (DEGREES,MINUTES): ",Deg,Min
 
Ang = (3.141593/180)*(Deg + Min/60)   'Convert to radians.
Height = Baselen*TAN(Ang)             'Calculate height.
PRINT "HEIGHT =" Height
H = 180 - Height
B = 15 + Baselen
 
LINE (15,180)-(B,180):LINE -(B,H)     'Draw triangle.
LINE -(10,180)
LOCATE 24,1 : PRINT "Press any key to continue...";
DO
LOOP WHILE INKEY$=""
 
* * ** * * * *