02-08-2006, 12:15 AM
Here's a little something I made in FB. It goes along with the review I'm doing in math right now.
Change the constants to get different waves.
Change the constants to get different waves.
Code:
'SINEWAVE.BAS
'By Zachary Vernon
'Draws a sinewave with domain 0<=x<=360.
'Change AMPLITUDE and PERDIODS constants to obtain different results.
CONST AMPLITUDE=100
CONST PERIODS=5
SCREENRES 800,600
WINDOW (0,0)-(800,600)
CONST PI AS DOUBLE=3.1415926
DIM AS DOUBLE Degrees,Y,OldY
FOR I=0 TO 360
Degrees=(PI/180)*I
Y=300+(SIN(Periods*Degrees)*(AMPLITUDE/2))
LINE (I-1,OldY)-(I,Y)
OldY=Y
IF I/10=I\10 AND I<>360 THEN LINE (I,300)-(I+5,300),9
NEXT
SLEEP
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
--------------------------------------
Freebasic is like QB, except it doesn't suck.