计算机二级VF程序设计的实例

文章作者 100test 发表时间 2007:03:10 18:17:39
来源 100Test.Com百考试题网


(一) 随机出10道100以内的整数加减法算数题

clear
ts=1
do whie ts&.lt.=10
czf=iif(rand()&.gt.0.5,&.quot. &.quot.,&.quot.-&.quot.)
num1=rand()*100
num2=rand()*100
&.nbsp. if =czf=&.quot. &.quot.
&.nbsp. if num1 num2&.gt.100
&.nbsp. &.nbsp. loop
&.nbsp. else
&.nbsp. &.nbsp. if num1&.lt.num2
&.nbsp. &.nbsp. &.nbsp. loop
&.nbsp. &.nbsp. endif
&.nbsp. endif
?&.quot.(&.quot. str (ts,2) &.quot.)&.quot. ” “ str (num1,2) czf str(num2,2) &.quot.=”
ts=ts 1
enddo


(二) 计算1,1/2,1/3...1/n之和,当&.lt.0.001时停止

set decimal 0 2
n=1
nsum=0
do while .t.
if 1/n &.lt.0.001
&.nbsp. exit
endif
nsum=nsum 2
n=n 1
enddo
wait windows &.quot.该系统之和为&.quot.



(三) 计算生肖自定义函数sx()

function sx
arameters nyear
local n,csx
csx=&.quot.羊猴鸡狗猪鼠牛虎兔龙蛇马&.quot.
if parameters()=0
nyear =year(date())
endif
n=mod(nyear,12) &.nbsp. &.nbsp. &.nbsp. &.nbsp. return substr (ncsx,2 &.quot.N&.quot. 1,2)
endfunc



(四) 计算 S=1! 2! 3! 4! 5! 6! 7! 8! 9!

s=0
for i=1 to 9
&.nbsp. s=s fjc(i)
endfor
?s
function fjc
parameters x
p=1
for n=1 to x
&.nbsp. p=p*x
endfor
return p
endfunc

相关文章


使用VisualFoxPro的ProgressBar控件
计算机等级考试二级VB考点分析之对象及其操作(2)
计算机二级VF程序设计的实例
计算机等级考试二级VB考点分析之对象及其操作(1)
浙江省高校计算机等级考试-大纲(二级——VisualFoxPro语言程序设计大纲)
计算机等级考试二级VB考点分析之程序开发环境(7)
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛