vb實例代碼-計算器(vb instance code calculator)

vb實例代碼-計算器(vb instance code calculator)

ID:36003259

大?。?8.72 KB

頁數(shù):15頁

時間:2019-04-29

vb實例代碼-計算器(vb instance code calculator)_第1頁
vb實例代碼-計算器(vb instance code calculator)_第2頁
vb實例代碼-計算器(vb instance code calculator)_第3頁
vb實例代碼-計算器(vb instance code calculator)_第4頁
vb實例代碼-計算器(vb instance code calculator)_第5頁
資源描述:

《vb實例代碼-計算器(vb instance code calculator)》由會員上傳分享,免費在線閱讀,更多相關內容在教育資源-天天文庫

1、vb實例代碼-計算器(VBinstancecodecalculator)First,thefollowingcontrolsneedtobecreated:Tags:Label1Commandbutton:NameCaptionvalueCback..CclearCECstartCCsinSinCcosCosCsqrtSqrtCsign+/-CpointCpointCequal=Controlarray:(commandbutton)Calcu(1)+Calcu(2)-Calcu(3)*Calcu(4)/Cnum(0)0Cnum(1)1...Cnum(9)9

2、Thenwritethesourcecodeinthecodewindow:OptionExplicitDimNum1,Num2AsDoubleDimPointInAsBooleanDimInputingAsBooleanDimOperation1AsIntegerPrivateSubCalcu_Click(IAsInteger)IfInputing=FalseThen'hasnotenterednewdataafterthelastoperationwassubmittedOperation1=I'operatorresetNum1=Label1'assi

3、gnsthedatainthedisplaycolumntothefirstoperandExitSubEndIfInputing=False'setsthecurrentstatetoanoninputdataphaseIfNum10Then<>'noncalculatedforthefirsttimeNum2=Label1'displaysthedatainthecolumntosecondoperandsCalculate(Operation1)'calculatesthepreviousoperationanddisplaystheresultEls

4、e'firstcomputationNum1=Label1'assignsthedatainthedisplaycolumntothefirstoperandEndIfOperation1=I'SubmitoperatorEndSubPrivateSubCback_Click()DimTheLenAsIntegerTheLen=Len(Label1)IfTheLen>2ThenIfRight(Label1,1)="."ThenLabel1=Left(Label1,TheLen-2)&"ElseLabel1=Left(Label1,TheLen-1)EndIf

5、ElseCclear_ClickEndIfEndSubPrivateSubCclear_Click()Label1="0.""Num2=0PointIn=FalseEndSubPrivateSubCcos_Click()Calculate(6)Inputing=FalseEndSubPrivateSubCequal_Click()IfInputingThen'ifyoujustentereddata'OrOperation1>0ThenNum2=Label1'displaysthedatainthecolumntosecondoperandsEndIfInp

6、uting=False'setsthecurrentstatetoanoninputdataphaseCalculate(Operation1)'calculatesthesubmittedoperationsanddisplaystheresultsNum1=0Operation1=0EndSubPrivateSubCalculate(OprtAsInteger)SelectCaseOprtCase1Num1=Num1+Num2ShowResult(Num1)Case2Num1=Num1-Num2ShowResult(Num1)Case3Num1=Num1

7、*Num2ShowResult(Num1)Case4Num1=Num1/Num2ShowResult(Num1)Case5Num2=Label1Num1=Sin(Num2)ShowResult(Num1)Case6Num2=Label1Num1=Cos(Num2)ShowResult(Num1)Case7num2=label1num1=sqr(num2)顯示診斷結果(num1)最后選擇端子列兵SubShowResult(Num雙)如果num=固定(努姆)然后整數(shù)標簽=民“?!盓lseIfLeft(num,1)=“”。然后第一個字符為小數(shù)點=“0”&Numla

8、bel1ElseIfLeft(num,2)=“”。然

當前文檔最多預覽五頁,下載文檔查看全文

此文檔下載收益歸作者所有

當前文檔最多預覽五頁,下載文檔查看全文
溫馨提示:
1. 部分包含數(shù)學公式或PPT動畫的文件,查看預覽時可能會顯示錯亂或異常,文件下載后無此問題,請放心下載。
2. 本文檔由用戶上傳,版權歸屬用戶,天天文庫負責整理代發(fā)布。如果您對本文檔版權有爭議請及時聯(lián)系客服。
3. 下載前請仔細閱讀文檔內容,確認文檔內容符合您的需求后進行下載,若出現(xiàn)內容與標題不符可向本站投訴處理。
4. 下載文檔時可能由于網(wǎng)絡波動等原因無法下載或下載錯誤,付費完成后未能成功下載的用戶請聯(lián)系客服處理。