Microsoft Small Basic
Program Listing:
Embed this in your website
<object id='sbapp' data='data:application/x-silverlight-2,' type='application/x-silverlight-2' width='640' height='480'> <param name='source' value='http://smallbasic.com/program/ClientBin/SBWeb.xap'/> <param name='onError' value='onSilverlightError' /> <param name='background' value='white' /> <param name='minRuntimeVersion' value='3.0.40624.0' /> <param name='autoUpgrade' value='true' /> <param name='initParams' value='programId=CFQ822' /> </object>
' Heart Mark and its area by NaochanON 2013/02/04
GraphicsWindow
.
PenColor
=
"red"
GraphicsWindow
.
PenWidth
=
2
L
=
30
X0
=
200
Y0
=
100
ds
=
0.05
dL
=
0.05
For
i
=
0
To
(
360
-
ds
)
Step
ds
X1
=
X0
+
L
*
math
.
Sin
(
Math
.
GetRadians
(
i
)
)
Y1
=
Y0
-
L
*
math
.
Cos
(
Math
.
GetRadians
(
i
)
)
GraphicsWindow
.
DrawLine
(
X0
,
Y0
,
X1
,
Y1
)
s
=
s
+
L
*
L
*
Math
.
GetRadians
(
ds
)
/
2
' area
If
i
<
180
Then
L
=
L
+
dL
Else
L
=
L
-
dL
EndIf
EndFor
GraphicsWindow
.
FontSize
=
20
GraphicsWindow
.
DrawText
(
120
,
10
,
"Area is ... "
+
math
.
Floor
(
S
*
10
)
/
10
)
Copyright (c) Microsoft Corporation. All rights reserved.