用vfp编写的计算器代码

来源:百度知道 编辑:UC知道 时间:2024/05/16 13:13:32
拜托各位,帮帮忙!不胜感激!

1)【提示】 操作步骤:
1)【提示】 操作步骤:
??第一步:向表单添加文本框和命令组控件,分别设置命令按钮的Caption属性,在对命令按钮"="的Caption
??属性设置时,不能在其属性窗口中直接输入半角的"=",否则提示语法错误。可以输入全角"="
??或在表单FROM1的Init事件中,输入如下代码完成:
??for i=1 to 10
??this.commandgroup1.buttons(i).caption=alltrim(str(i))
??endfor
??this.commandgroup1.buttons(11).caption="*"
??this.commandgroup1.buttons(12).caption="+"
??this.commandgroup1.buttons(13).caption="-"
??this.commandgroup1.buttons(14).caption="="
??this.commandgroup1.buttons(15).caption="C"
??
??第二步:在表单FORM1的Init事件中定义全局变量T,并赋初值空串
??PUBLIC T=''
??第三步:编写命令组的Click事件代码,完成接收输入的表达式:
??do case
??case this.value=1
??t=t+"1"
??thisform.text1.value=t
??case this.value=2
??t=t+"2"
??thisform.text1.value=t
??case this.value=3
??t=t+"3"
??thisform.text1.value=t
??case this.v