电脑编程初级题

来源:百度知道 编辑:UC知道 时间:2024/05/26 06:20:44
我是新手(用中文表示)定义,读入,输出
1.输入圆的半径r,求圆的面积
2.判断3条线a.b.c能否构成直角三角形,如能计算出面积
VB的,因为是初级,所以越简单越好。举例:xyz为integer
读入x
读入y
x赋值于z
y赋值于x
z赋值于y
输出x.y

Dim PI As Double
PI = 3.14

Text2.Text = FormatNumber(PI * Val(Text1.Text) * Val(Text1.Text). 2)

三角形:
Dim a, b, c, p As Double
a = Val(Text1.Text)
b = Val(Text2.Text)
c = Val(Text3.Text)
p = (a + b + c) / 2
if a + b > c And a + c > b And b + c > a Then
Text4.Text = Str(Sqr(p * (p - a) * (p - b) * (p - c)))
Else
Text4.Text = "Math Error!"
End If