VF数字化程序及表单设计
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
数字化程序及表单设计
1.(prog1.prg,form1.scx)已知圆半径,求圆面积。
clear
input"请输入圆的半径=" to r
if r>0
s=pi()*r*r
?s
else
?"输入错误!"
endif
return
r=thisform.text1.value
s=pi()*r*r
thisform.text2.value=alltrim(str(s,10,2))
4.(prog2.prg,form2.scx)已知三角形三边,求三角形的面积。S=SQRT(L*(L-A)*(L-B)*(L-C)) ,其中L=(A+B+C)/2
clear
input"a=" to a
input"b=" to b
input"c=" to c
if a>0
b>0
c>0
a+b>c
a+c>b
b+c>a
l=(a+b+c)/2
s=sqrt(l*(l-a)*(l-b)*(l-c))
?s
else
?"输入错误"
Endif
a=thisform.text1.value
b=thisform.text2.value
c=thisform.text3.value
if a+b>c and b+c>a and a+c>b and a>0 and b>0 and c>0
l=(a+b+c)/2
s=sqrt(l*(l-a)*(l-b)*(l-c))
endif
thisform.text4.value=s
5.(prog3.prg,form3.scx)判断某一年是否是闰年。
clear
input"请输入年份:" to year
if year%400=0
?year,"年是闰年!"
else
?year,"年不是润年!"
endif
return
year=thisform.text1.value
if year%400=0
thisform.text2.value= "是闰年"
else
thisform.text2.value= "不是闰年"
endif
6.(prog4.prg,form4.scx)判断月份值的春夏秋冬。
clear
input"请输入月份:" to yue
do case
case inlist (yue,3,4,5)
?"春"
case inlist (yue,6,7,8)
?"夏"
case inlist (yue,9,10,11)
?"秋"
case inlist (yue,12,1,2)
?"冬"
otherwise
?"输入错误"
endcase
return
yue=thisform.text1.value
do case
case inlist (yue,3,4,5)
thisform.text2.value="春"
case inlist (yue,6,7,8)
thisform.text2.value="夏"
case inlist (yue,9,10,11)
thisform.text2.value="秋"
case inlist (yue,12,1,2)
thisform.text2.value="冬"
endcase
2.(prog5.prg,form5.scx)输入一个整数,并判断其奇偶性。
clear
input"请输入一个数:"to n
if mod(n,2)=0
?"偶数"
else
?"奇数"
Endif
x=thisform.text1.value
if mod(x,2)=0
thisform.text2.value="偶数"
else
thisform.text2.value="奇数"
endif
7.(prog6.prg,form6.scx)输入成绩,判断等级。
clear
input "请输入成绩:" to a
do case
case a>=0 and a<=60
cj="差"
case a>60 and a<90
cj="良"
case a>=90 and a<=100
cj="优"
otherwise
cj="错误" endcase
?cj
return
a=thisform.text1.value
do case
case a>=0 and a<=60
cj="差"
case a>60 and a<90
cj="良"
case a>=90 and a<=100
cj="优"
otherwise
cj="错误"
endcase
bel2.caption=cj
8.(prog7.prg,form7.scx)输入任意两个数,比较大小,输出较大数或较小数。
clear
input"请输入一个数:" to a
input"请输入一个数:" to b
if a>b
?a
else
?b
endif
a=thisform.text1.value
b=thisform.text3.value
if a>b
thisform.text2.value=a
else
thisform.text2.value=b
endif
9.(prog8.prg,form8.scx)S=1+2+……+n
clear
input "n=" to n
s=1
i=1