vb计算机器,科学计算器vb代码
《科學(xué)計(jì)算器vb代碼》由會(huì)員分享,可在線閱讀,更多相關(guān)《科學(xué)計(jì)算器vb代碼(30頁(yè)珍藏版)》請(qǐng)?jiān)谌巳宋膸?kù)網(wǎng)上搜索。
1、用VB寫計(jì)算器似乎有很多例子,這個(gè)代碼就是其中之一,科學(xué)計(jì)算器是在基本計(jì)算器的基礎(chǔ)上,加入角度、弧度、梯度、正切、余切、正弦余弦、平方根等的數(shù)學(xué)計(jì)算,當(dāng)然基礎(chǔ)的加減乘除運(yùn)算就更不用說了,這是在一本VB教程中摘錄的代碼,你可以此為基礎(chǔ)完善擴(kuò)展該計(jì)算器的功能,運(yùn)行截圖如下:LnAtaiLFI核心代碼,只有一個(gè)文件代碼:VERSIONBegin Frm_ScientificCaption =計(jì)算器Clie ntHeight = 2925Clie ntLeft= 165Clie ntTop= 735Clie ntWidth = 5595Li nkTopic= Form1LockCo ntrols = 。
2、-1 TrueMaxButt on = 0 FalseScaleHeight = 2925ScaleWidth = 5595StartUpPosition = 3 窗口缺省Begin Cmd_R ndCapti onRndHeight390Left5025Tabln dex39Top1455Width510EndBegi n Cmd_PICapti onPIHeight390Left1575Tabln dex38Top2400Width630EndBeg in Cmd_FactCapti onN!Height390Left1575Tabln dex37Top1935Width630EndBeg。
3、 in Cmd_LogCapti onLogHeight=390Left=1575Tabln dex=36Top=1455Width=630EndBegi n Cmd__LnCapti on=L nHeight=390Left=1575Tabln dex=35Top=960Width=630EndBeg in Cmd_SquareCapti on=XA2Height=390Left=840Tabln dex=34Top=2400Width=630EndBegi n Cmd__CubeCapti on=XA3Height=390Left=825Tabln dex=33Top=1935Width=。
4、630EndBeg in Cmd_OperatorCapti on=XAY:Height=390Index=5Left=840Tabln dex=32Top=1455Width=630EndBegi n Cmd__ExpCapti on=ExpHeight=390Left=840Tabln dex=31Top=960Width=630EndBegi n Cmd__SinCapti on=SinHeight=390Left=120Tabln dex=30Top=960Width=630EndBegi n Cmd__CosCapti on=CosHeight=390Left=120Tabln de。
5、x=29Top=1455Width=630EndBegi n Cmd__TanCapti on=Ta nHeight=390Left=120Tabln dex=28Top=1935Width=630EndBegi n Cmd__AtanCapti on=Ata nHeight=390Left=120Tabln dex=27Top=2400Width=630EndBeg in FramelHeight=510Left=90Tabln dex=23Top=330Width=2625Begin Otn_GrdCapti on一II梯度“Height=180Left=1695Tabln dex=26T。
6、op=210Width=750EndBegin Otn_RadCapti on一II弧度“Height=180Left=900Tabln dex=25Top=210Width=795EndBegin Otn_DegCapti on一II角度“Height=180Left=135Tabln dex=24Top=210Value=-1 TrueWidth=675EndEndBeg in Cmd_OperatorCapti on一ll_llHeight=390Index=4Left=5025Tabln dex=22Top=2400Width=510EndBeg in Cmd_OperatorCapt。
7、i on=+Height=390Index=3Left=4470Style=1 GraphicalTabln dex=21Top=2400Width=510EndBeg in Comma nd1Capti onII IIHeight=390Index=11Left=3915Tabln dex=20Top=2400Width=510EndBeg in Comma nd1Capti on=+/-Height=390Index=10Left=3360Tabln dex=19Top=2400Width=510MaskColor&H00808080&EndBeg in Comma nd1Capti on。
8、=0Height=390Index=0Left=2820Tabln dex=18Top=2400Width=510EndBegi n Cmd_.fractionCapti on=1/xHeight=390Left=5025Tabln dex=17Top=1935Width=510EndBeg in Cmd_sqrtCapti on=SqrtHeight=390Left=5025Tabln dex=16Top=960Width=510EndBegi n Cmd__CCapti on=CHeight=405Left=4785Tabln dex=15Top=405Width=750EndBegi n。
9、 Cmd__CECapti on=CEHeight=405Left=3975Tabln dex=14Top=405Width=750EndBegi n Cmd_.BackspaceCapti on=BackspaceHeight=405Left=2820Tabln dex=13Top=405Width=1110EndBeg in Cmd_OperatorCapti onII IIHeight=390Index=2Left=4470Tabln dex=12Top=1935Width=510EndBeg in Cmd_OperatorCapti on一 *Height=390Index一 1Lef。
10、t一 4470Tabln dex一 11Top一 1455Width一 510EndBeg in Cmd_OperatorCapti on一 /Height一 390Index一 0Left一 4470Tabln dex一 10Top一 960Width一 510EndBeg in Comma nd1Capti on=9Height=390Index=9Left=3915Tabln dex=9Top=960Width=510EndBeg in Comma nd1Capti on=8Height=390Index=8Left=3360Tabln dex=8Top=960Width=510EndB。
11、eg in Comma nd1Capti on=7Height=390Index=7Left=2820Tabln dex=7Top=960510WidthEndBeg in Comma nd1Capti on=6Height=390Index=6Left=3915Tabln dex=6Top=1455Width=510EndBeg in Comma nd1Capti on=5Height=390Index=5Left=3360Tabln dex=5Top=1455Width=510EndBeg in Comma nd1Capti on=4Height=390Index=4Left=2820Ta。
12、bln dex=4Top=1455Width=510EndBeg in Comma nd1Capti on=3Height=390Index=3Left=3915Tabln dex=3Top=1935Width=510EndBeg in Comma nd1Capti on=2Height=390Index=2Left=3360Tabln dex=2Top=1935Width=510EndBeg in Comma nd1Captio n= 1Height = 390In dex= 1Left= 2820Tabln dex= 1Top= 1935Width= 510EndBegin Txt_Res。
13、ultAlig nment= 1 Right JustifyHeight= 315Left= 90Locked= -1 TrueTabln dex= 0Text= 0.Top= 0Width= 5385EndBegin Men u_EditCapti on=編輯(&E)Begin Me nu_CopyCapti on=復(fù)制“Shortcut= ACEndBegin Men u_PasteCapti on=粘貼Shortcut= AEndBegin Me nu_CutCapti on=剪切“Shortcut= AXEndBegi n linelCaptio n=-EndBegin Men u_A。
14、llCapti on=全選Shortcut= aaEndBegi n line2Captio n=-EndBegin Men u_ExitCapti on=退出“EndEndBegin Me nu_HelpCapti on=幫助(&H)Begin Men u_HelpSubjectCapti on=幫助主題(&H)EndBegin Me nu_AboutCaption=關(guān)于計(jì)算器EndEndEndAttribute VB_Name = Frm_Scie ntificAttribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = Fals。
15、eAttribute VB_Predeclaredld = TrueAttribute VB_Exposed = FalseOpti on ExplicitDim que(25) As DoublePublic qt As In tegerPublic qh As In tegerPublic qv As In tegerPublic ang As DoublePublic memo As DoubleDim dflag As In tegerDim i As In tegerDim opnre As In tegerDim prev As DoubleDim oflag As In tege。
16、rDim ind As In tegerPrivate Sub Cmd_Atan_Click() Ata n函數(shù)=Str(At n( Val) / ang)prev =End Sub退格Private Sub Cmd_Backspace_Click()If = 0. The nExit SubEnd IfIf 0 The n=Str(1 / Temp)Else=除數(shù)不能為零。“End Ifprev =End SubPrivate Sub Cmd_Ln_Click() LNIf Vai 0 Then=Str(Log(Val)Else=輸入有誤。“End Ifprev =End SubPrivat。
17、e Sub Cmd_Log_Click() LogIf Val 0 The n=Str(Log(Val) / Log(10)Else=輸入有誤。“End Ifprev =End Sub單擊操作符按鈕Private Sub Cmd_Operator_Click( In dex As In teger)If opnre = 0 Or In dex = 4 The nIf i nd = 3 The n 力廿號(hào)prev = prev + ValElseIf i nd = 2 The n減號(hào)prev = prev - ValElseIf i nd = 0 The n除號(hào)If Val = 0 The n=。
18、除數(shù)不能為零。“Exit SubElseprev = prev / ValEnd IfElself ind = 5 Then 紬prev = prev A ValElself i nd = 1 The n 乘號(hào)prev = prev * ValEnd IfIf prev = 0 The n如果前一個(gè)操作數(shù)為 0prev =將當(dāng)前的值傳給操作數(shù)Else否則=Str(prev)將操作數(shù)的值傳遞給文本框顯示End Ifoflag = 0End Ifopnre = 1ind = In dexdflag = 0End SubPrivate Sub Cmd_PI_Click()卩1prev =End Su。
19、bPrivate Sub Cmd_R nd_Click()產(chǎn)生一個(gè)隨機(jī)數(shù)=Str(R nd)End SubPrivate Sub Cmd_Sin_Click() Sin值=Str(Si n(ang * Val)prev =End SubPrivate Sub Cmd_sqrt_Click()求平方根Dim Temp As In tegerTemp = ValIf Temp 0 Or Temp = 0 The n=Str(Sqr(Val)Else=函數(shù)輸入無(wú)效。”End IfEnd SubPrivate Sub Cmd_Square_Click()求平方=Val 人 2prev =End SubPrivate Sub Cmd_Tan_Click() Tan函數(shù)If (Cos(Val) . ThenIf 12) The n=輸入的數(shù)值過大。“ffac = numElsere = 1While (num 0)re = re * numnum = num - 1Wendfac = reEnd IfEnd IfEnd Fun cti onVB科學(xué)計(jì)算器代碼,新建一工程后引入上述代碼文件編譯即可。
總結(jié)
以上是生活随笔為你收集整理的vb计算机器,科学计算器vb代码的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux df命令功能,Linux d
- 下一篇: c语言:1000瓶水,有一瓶是有毒的,现