VB中求一个数的平方根的代码
发布网友
发布时间:2023-08-16 14:16
我来回答
共2个回答
热心网友
时间:2024-12-02 03:16
private
sub
form_click()
dim
intflag
as
integer
dim
strnumber
as
string
dim
strmsg
as
string
strnumber
=
inputbox("输入一个数")
msg$
=
"输入的数是:"
+
strnumber
+
chr$(13)
+
chr(10)
+
"确认是否正确"
intflag
=
msgbox(msg$,
36)
if
intflag
=
6
then
print
"sqr(";
strnumber;
")=";
sqr(val(strnumber))
else
print
"取消操作"
end
if
end
sub
private
sub
form_load()
autoredraw
=
true
print
"计算一个数的平方根"
print
"单击窗体开始"
end
sub
热心网友
时间:2024-12-02 03:17
b=sqr(a)
b为a的平方根