用vb编写程序,求任意半径和高的圆柱的表面积
答案:3 悬赏:80 手机版
解决时间 2021-03-04 15:25
- 提问者网友:龅牙恐龙妹
- 2021-03-04 07:30
用vb编写程序,求任意半径和高的圆柱的表面积
最佳答案
- 五星知识达人网友:低血压的长颈鹿
- 2021-03-04 07:35
S
Print "圆柱的表面积=";体 积="Private Sub form_click()
Dim R As Single
Dim H As Single
Dim S As Single
Dim V As Single
Const Pi = 3.14159
R = 1.5
H = 3
S = (Pi * R * R) * 2 + (2 * Pi * R) * H
V = (Pi * R * R) * H
Print "
Print "圆柱的表面积=";体 积="Private Sub form_click()
Dim R As Single
Dim H As Single
Dim S As Single
Dim V As Single
Const Pi = 3.14159
R = 1.5
H = 3
S = (Pi * R * R) * 2 + (2 * Pi * R) * H
V = (Pi * R * R) * H
Print "
全部回答
- 1楼网友:像个废品
- 2021-03-04 08:37
private sub cmd1_click()
dim r as double
dim h as double
const pi = 3.1415926
'先用inputbox函数引入底面半径和高
r = val(inputbox("请输入圆柱体底面半径:"))
h = val(inputbox("请输入圆柱体的高:"))
'圆柱体的表面积=侧面积+两个底面积
dim s as double
s = pi * 2 * r * h + 2 * pi * r * r
lab1.caption = s
end sub
private sub cmd2_click()
dim r as double
dim h as double
const pi = 3.1415926
'先用inputbox函数引入底面半径和高
r = val(inputbox("请输入圆柱体底面半径:"))
h = val(inputbox("请输入圆柱体的高:"))
'圆柱体的体积=底面积*高
dim v as double
v = pi * r * r * h
lab2.caption = v
end sub代码不难,简单的公式处理而已,希望你自己好好消化一下,好好学习,天天向上,祝愉快!!!
遵照“浪花飘零2000”这位朋友的意见,表面积公司略作修改完善!!
你仔细检查一下label1这些控件的名称是否正确!!
- 2楼网友:夜风逐马
- 2021-03-04 07:58
" & s1 + s2 '一个标签;圆柱的表面积是.Caption = ",输入半径和高 L = 2 * 3.1415926 * r s1 = L * r s2 = L * h Label1;二个文本框Private Sub Command1_Click() r = Val(Text1) h = Val(Text2) '
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯