求用Visual Foxpro 编写计算器源代码

来源:百度知道 编辑:UC知道 时间:2024/05/31 22:20:03
要用VF编写一个计算器!(步骤一定详细*)
会写的帮忙下,COPY的滚!
希望高手来帮下忙!急用
如果确实可以用的话继续追加50分!

通过键盘输入数 实现+ - * /功能
在表单里建 六个命令按钮 + - * / = c(清零) 一个文本框
写代码
右键 代码 对form1初始化 过程为init
public a,b,c,d
d=0
文本框代码 text1 过程lostfocus
c=thisform.text1.value
命令按钮+(command1) 过程click
a=c
c='0'
thisform.text1.value=c
b='+'
命令按钮-(command2) 过程同上
a=c
c='0'
thisform.text1.value=c
b='-'
乘法的 a=c
c='0'
thisform.text1.value=c
b='*'
除法的 a=c
c='0'
thisform.text1.value=c
b='/'
等号的 if b='+'
d=val(a)+val(c)
c=str(d)

thisform.text1.value=d
endif
if b='-'
thisform.text1.value=val(a)-val(c)
endif
if b='*'
thisform.text1.value=val(a)*val(c)
endif
if b='/'
thisform.text1.value=val(a)/val(c)
end