欢迎来到天天文库
浏览记录
ID:42037773
大小:128.25 KB
页数:25页
时间:2019-09-06
《计算器设计代码》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、DimNumlAsDouble"Num2AsDoublpEqualAsDoub-0Equal2AsIntegerDimStrNumlAsstring》StrNum2AsStringDimFirstPointAsBoooapFirstNumAsBooleanPrivateSubCommandl—click(IndexAsImeger)Select:CaseIndexCase0To9烽也SirNumlnLTrim(su-Numl)+LTrim(str(Index))DoWhileLe»LTrim(shNuml)91)H6-SirNumlHMid(SWNUmL2
2、)LoopIf1)HThenStrNumlH・q+LTrim(sirNuml)Texil.TextHSirNumlcaseodw、;DrIfFirstPoimThenStrNumlHErrim(strNuml)+LTrimc;)DoWhileLefi(urrim(SWNUmD1)H=0=StrNumlnMid(strNumr-2)LoopIfLeft(LTrim(SWNUmD1)H=.=ThgSMNumlHd二+LTrim(StrNuml)Text1.Text=StrNumlFirstPoint=FalseText1.Text=StrNumlEndIfCa
3、se11退格StrNuml=Text1.TextIfLen(StrNuml)>0ThenStrNuml=Left(StrNuml,Len(StrNuml)-1)Text1.Text=StrNumlElseTextl.Text二”0.0”EndIfIfInStr(StrNuml,=0ThenFirstPoint=TrueCase12清零StrNuml二"StrNum2二””Textl.Text=n0.0naa=,,nEqual=0Numl=0Num2=0FirstPoint=TrueFirstNum=TrueCase13'正负符号IfVal(StrNuml)
4、>OThenStrNum二叮+LTrim(StrNuml)ElseStrNum1=Abs(Val(StrNuml))EndIfText1.Text=StrNumlEndSelectEndSubPrivateSubCommand2_Click(IndexAsInteger)'+・*/运算Equal2=IndexIfFirstNumThenStrNum2=StrNumlStrNuml二"FirstNum=FalseFirstPoint=TrueElseSelectCaseIndexCase0加法Numl=Val(StrNum2)Num2=Val(StrNuml
5、)Equal=Numl+Num2StrNum2=Str(Equal)StrNuml二””aa=Str(Equal)IfLeft(LTrim(aa),1)=n-nAndLeft(LTrim(aa),2)=n-.nThenaa=n-On+LTrim(Abs(Equal))EndIfIfLeft(LTrim(aa),1)=H.nThenaa=uOn+LTrim(aa)Text1.Text=aaFirstPoint=TrueCase1減法Numl=Val(StrNum2)Num2=Val(StrNuml)Equal=Numl-Num2StrNum2=Str(Equ
6、al)StrNuml=m,aa=Str(Equal)IfLeft(ETrim(aa),1)=AndLeft(ETrim(aa),2)=n-.nThenaa=n-On+LTrim(Abs(Equal))EndIfIfLeft(LTrim(aa),1)=H.HThenaa=nOn+LTrim(aa)Text1.Text=aaFirstPoint=TrueCase2,乘法Numl=Val(StrNum2)IfStrNuml='n'ThenNum2=1ElseNum2=Val(StrNuml)EndIfEqual=Numl*Num2StrNum2=Str(Equa
7、l)StrNuml二“aa=Str(Equal)IfLeft(LTrim(aa),1)=n-nAndLeft(ETrim(aa),2)=H-.HThenaa=H-0n+LTrim(Abs(Equal))EndIfIfLemEmmEh1)H=.=ThenaaHLTrim(aa)Textl.TbxinaaFirstPointHTrueCase3爲弄IfswNumHIThenNumlnEqu巴ElseNumlHval(strNum2)EndIfIfSwNumlIThgNum2H1ElseNum2"val(Texrl.Text)EndIfEqualHNuml-Nu
8、m2ShNumlH==aanSMEqual)IfLeft(LTri
此文档下载收益归作者所有