![科學(xué)計(jì)算器講解_第1頁](http://file2.renrendoc.com/fileroot_temp3/2021-6/13/cce9016e-cef4-4371-bda0-0faca8f0528e/cce9016e-cef4-4371-bda0-0faca8f0528e1.gif)
![科學(xué)計(jì)算器講解_第2頁](http://file2.renrendoc.com/fileroot_temp3/2021-6/13/cce9016e-cef4-4371-bda0-0faca8f0528e/cce9016e-cef4-4371-bda0-0faca8f0528e2.gif)
![科學(xué)計(jì)算器講解_第3頁](http://file2.renrendoc.com/fileroot_temp3/2021-6/13/cce9016e-cef4-4371-bda0-0faca8f0528e/cce9016e-cef4-4371-bda0-0faca8f0528e3.gif)
![科學(xué)計(jì)算器講解_第4頁](http://file2.renrendoc.com/fileroot_temp3/2021-6/13/cce9016e-cef4-4371-bda0-0faca8f0528e/cce9016e-cef4-4371-bda0-0faca8f0528e4.gif)
![科學(xué)計(jì)算器講解_第5頁](http://file2.renrendoc.com/fileroot_temp3/2021-6/13/cce9016e-cef4-4371-bda0-0faca8f0528e/cce9016e-cef4-4371-bda0-0faca8f0528e5.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、科學(xué)計(jì)算器1、基本功能的設(shè)計(jì)實(shí)現(xiàn)了一個(gè)功能強(qiáng)大的科學(xué)計(jì)算器不僅實(shí)現(xiàn)了標(biāo)準(zhǔn)的加減乘除運(yùn)算,而其還可以進(jìn)行三角函數(shù)、對數(shù)、邏輯等復(fù)雜運(yùn)算。使用者 可以通過按鈕和菜單轉(zhuǎn)換計(jì)算器的類型。本例的計(jì)算器具有如下功能。 科學(xué)計(jì)算器中, BackSpance、CE、C 和運(yùn)算符號 +、-、* 、/、.、-/+、=以及標(biāo)準(zhǔn)型計(jì)算器的設(shè)計(jì)。 科學(xué)型角度弧度的設(shè)計(jì)。 科學(xué)計(jì)算器中, x2,x3,xy,1/x,n !,Log,In 按鍵,及各進(jìn)制轉(zhuǎn)之間的相互轉(zhuǎn)換的設(shè)計(jì)。 科學(xué)計(jì)算器中, sin, cos,tan,dms,F-E,Exp、pi、Dat、s、Sum 等按 鈕以 sin/cos/tan 計(jì)算時(shí)角度和弧度的轉(zhuǎn)
2、換的設(shè)計(jì)。 科學(xué)行計(jì)算器中, Mod,Not ,And,Xor ,Int,Or,lsh,exit 按鈕。 標(biāo)準(zhǔn)型菜單部分(查看菜單標(biāo)準(zhǔn)型、科學(xué)型。幫助菜單中包含關(guān)于(about)及標(biāo)準(zhǔn)型和科學(xué)型的數(shù)字鍵和科學(xué)型的各進(jìn)制轉(zhuǎn)換的設(shè)計(jì)。2、編成流程3、詳細(xì)設(shè)計(jì)( 1)Animal1 窗體Animal1 窗體是標(biāo)準(zhǔn)的計(jì)算器操作界面Dim dflag As IntegerDim i As IntegerDim opnre As IntegerDim prev As DoubleDim oflag As IntegerDim ind As IntegerPrivate Sub Command1_Click
3、(Index As Integer)If ind = 4 Thenprev = 0Text1.Caption = ind = 0End If opnre = 0 If oflag = 0 ThenText1.Caption = End If oflag = 1 If Command1(Index).Caption . ThenIf Text1.Caption 0 ThenText1.Caption = Text1.Caption & Command1(Index).Caption ElseText1.Caption = & Command1(Index).Caption End IfElseI
4、f dflag = 0 ThenText1.Caption = Text1.Caption & . dflag = 1ElseMsgBox (ILLEGAL SAIRAM) End IfEnd IfEnd SubPrivate Sub Command2_Click(Index As Integer) If opnre = 0 Or Index = 4 ThenIf ind = 0 Thenprev = prev + Val(Text1.Caption) ElseIf ind = 1 Thenprev = prev - Val(Text1.Caption) ElseIf ind = 2 Then
5、If Val(Text1.Caption) = 0 Then MsgBox (SORRY DIVIDE ZERO) Exit SubElseprev = prev / Val(Text1.Caption) End IfElseIf ind = 3 Then prev = prev * Val(Text1.Caption)End IfText1.Caption = Str(prev) oflag = 0 End If opnre = 1 ind = Index dflag = 0End SubPrivate Sub Command3_Click() Text1.Caption = 0End Su
6、bPrivate Sub Command4_Click() dflag = 0 prev = 0 oflag = 0 ind = 0 opnre = 0Text1.Caption = 0End SubPrivate Sub Command5_Click() Unload Me scientific.ShowEnd SubPrivate Sub ecopy_Click() Clipboard.Clear Clipboard.SetText Text1.CaptionEnd SubPrivate Sub ecut_Click()Clipboard.ClearClipboard.SetText Te
7、xt1.CaptionText1.Caption = End SubPrivate Sub eexit_Click()Unload MeEnd SubPrivate Sub epaste_Click()Text1.Caption = Text1.Caption = Clipboard.GetText() End SubPrivate Sub eselectall_Click()Clipboard.ClearClipboard.SetText Text1.CaptionEnd SubPrivate Sub Form_KeyPress(KeyAscii As Integer)If KeyAscii
8、 = Asc(.) Theni = 10Command1_Click (i)BeepElseIf KeyAscii = Asc(0) Theni = 0Command1_Click (i)BeepElseIf KeyAscii = Asc(1) Theni = 1Command1_Click (i)BeepElseIf KeyAscii = Asc(2) Theni = 2Command1_Click (i)BeepElseIf KeyAscii = Asc(3) Theni = 3Command1_Click (i)BeepElseIf KeyAscii = Asc(4) Theni = 4
9、 Command1_Click (i)BeepElseIf KeyAscii = Asc(5) Then i = 5Command1_Click (i) BeepElseIf KeyAscii = Asc(6) Then i = 6Command1_Click (i) BeepElseIf KeyAscii = Asc(7) Then i = 7Command1_Click (i) BeepElseIf KeyAscii = Asc(8) Then i = 8Command1_Click (i) BeepElseIf KeyAscii = Asc(9) Then i = 9Command1_C
10、lick (i) BeepElseIf KeyAscii = Asc(0) Then i = 0Command1_Click (i) BeepElseIf KeyAscii = Asc(+) Then i = 0Command2_Click (i) BeepElseIf KeyAscii = Asc(+) Then i = 0Command2_Click (i) BeepElseIf KeyAscii = Asc(-) Then i = 1Command2_Click (i) BeepElseIf KeyAscii = Asc(/) Then i = 2Command2_Click (i) B
11、eepElseIf KeyAscii = Asc(*) Then i = 3Command2_Click (i) BeepElseIf KeyAscii = Asc(=) Then i = 4Command2_Click (i) BeepElseIf KeyAscii = Asc(c) Or KeyAscii = Asc(C) Then dflag = 0 prev = 0 oflag = 0 ind = 0 opnre = 0Text1.Caption = 0BeepBeepElseIf KeyAscii = Asc(d) Or KeyAscii = Asc(D) Then Text1.Ca
12、ption = 0BeepEnd IfEnd SubPrivate Sub Form_Load() standard.Height = 4090 standard.Width = 3430 dflag = 0 prev = 0 oflag = 0 ind = 0 opnre = 0 Clipboard.ClearEnd SubPrivate Sub habout_Click() nachelp.ShowEnd SubPrivate Sub hcontents_Click() nachelp.ShowEnd SubPrivate Sub Option1_Click() scientific.Sh
13、ow standard.Option1.Value = False standard.HideEnd SubPrivate Sub tscientific_Click() scientific.Show standard.HideEnd SubPrivate Sub tstandard_Click() standard.Show scientific.HideEnd Sub2)Anima2 窗體Anima2 窗體是科學(xué)計(jì)算器的操作界面Dim que(25) As Double Public qt As Integer Public qh As Integer Public qv As Inte
14、ger Public ang As DoublePublic memo As Double Dim dflag As Integer Dim i As Integer Dim opnre As Integer Dim prev As Double Dim oflag As Integer Dim ind As IntegerPrivate Sub Command1_Click(Index As Integer) If ind = 4 Thenprev = 0 Text1.Text = ind = 0End Ifopnre = 0 conform operandIf oflag = 0 Then
15、 if previous operator clear text Text1.Text = End Ifoflag = 1 If Command1(Index).Caption . ThenIf Text1.Text 0 ThenText1.Text = Text1.Text & Command1(Index).Caption ElseText1.Text = & Command1(Index).Caption End IfElseIf dflag = 0 Then Text1.Text = Text1.Text & . dflag = 1Else MsgBox (ILLEGAL SAIRAM
16、)End IfEnd IfEnd SubPrivate Sub Command10_Click(Index As Integer)If Index = 2 ThenIf Val(Text1.Text) 0 ThenText1.Text = Str(Log(Val(Text1.Text) ElseMsgBox ( ILLEGAL. LOG NON POSITIVE ) End IfElseIf Index = 1 ThenIf Val(Text1.Text) 0 ThenText1.Text = Str(Log(Val(Text1.Text) / Log(10) ElseMsgBox ( ILL
17、EGAL. LOG NON POSITIVE ) End IfEnd IfEnd SubPrivate Sub Command11_Click()If (Text1.Text ) Then9Text1.Text = Mid(Text1.Text, 1, Len(Text1.Text) - 1) End IfEnd SubPrivate Sub Command13_Click()Unload MeEnd SubPrivate Sub Command14_Click()Text1.Text = Str(Val(Text1.Text) * -1)End Sub Function qnext(p As
18、 Integer) As IntegerOn Error Resume Next qnext = (p + 1) Mod qtEnd FunctionFunction power(x As Double, Y As Long) As Double Dim i As Double i = 1If (Y 0) Then While Y 0Y = Y - 1i = i * x Wend power = i ElseIf (Y = 0) Then power = 1 ElseMsgBox (ILLEGAL. POWER LESTHAN 0.) End IfEnd FunctionFunction fa
19、ct(num As Long) As LongIf (num 12) ThenMsgBox (VALUE TOO LARGE) fact = numElsere = 1 While (num 0) re = re * num num = num - 110Wend fact = re End IfEnd IfEnd Function Private Sub Command2_Click(Index As Integer)Dim n As LongDim r As LongIf opnre = 0 Or Index = 4 ThenIf ind = 0 Thenprev = prev + Val
20、(Text1.Text) ElseIf ind = 1 Thenprev = prev - Val(Text1.Text) ElseIf ind = 6 Then prev = prev Mod Val(Text1.Text)ElseIf ind = 7 Then r = Fix(Val(Text1.Text) n = Fix(Val(prev) If (n r Or n = r) And n 0 And (r 0 Or r = 0) Then prev = fact(n) / (fact(n - r)ElseMsgBox (ILLEGAL ENTRIES of N ,R ) End IfEl
21、seIf ind = 5 Then r = Fix(Val(Text1.Text) n = Fix(Val(prev) If (n r Or n = r) And n 0 And (r 0 Or r = 0) Then prev = fact(n) / (fact(n - r) * fact(r) ElseMsgBox (ILLEGAL ENTRIES of N ,R ) End IfElseIf ind = 8 ThenIf (Text1.Text = Or prev = 0) ThenMsgBox (ILLEGAL. INV ALIED ENTRIES) Else prev = (powe
22、r(prev, Fix(Val(Text1.Text)End IfElseIf ind = 2 ThenIf Val(Text1.Text) 0 Then prev = prev / Val(Text1.Text)11ElseMsgBox ( ILLEGAL DIVIDE 0 ) End IfElseIf ind = 3 Then prev = prev * Val(Text1.Text)End IfText1.Text = Str(prev) oflag = 0 operator or operandEnd Ifopnre = 1 multiple operators flagind = I
23、ndexdflag = 0End SubPrivate Sub Command3_Click(Index As Integer) Text1.Text = 0End SubPrivate Sub Command4_Click(Index As Integer) memo = 0 dflag = 0 prev = 0 oflag = 0 ind = 0 opnre = 0 qh = 0 qt = 0Clipboard.ClearText1.Text = 0End SubPrivate Sub Command5_Click(Index As Integer) Select Case IndexCa
24、se 0Text1.Text = Str(Sin(ang * Val(Text1.Text)Case 1Text1.Text = Str(Cos(ang * Val(Text1.Text)Case 2If (Cos(Val(Text1.Text) 0 Then Text1.Text = Str(Sin(ang * Val(Text1.Text) / Cos(ang * Val(Text1.Text)ElseMsgBox (ILLEGAL. DIVIDE BY ZERO ) End If12Case 5Text1.Text = Str(Atn(Val(Text1.Text) / ang)End
25、SelectEnd SubPrivate Sub Command6_Click(Index As Integer)Dim re As LongDim temp As Longtemp = Val(scientific.Text1.Text)Select Case IndexCase 2 temp = Val(Text1.Text)If temp 0 Or temp = 0 Then scientific.Text1.Text = Str(Sqr(Val(Text1.Text)ElseMsgBox ( ILLEGAL ATTEMPTING NEGETIVE ROOT)End IfCase 0te
26、mp = Val(Text1.Text)If temp 0 Then scientific.Text1.Text = Str(1 / temp)ElseMsgBox ( ILLEGAL DIVIDE 0 )End IfCase 1If Abs(Val(Text1.Text) 46300 Then scientific.Text1.Text = Str(temp * temp)ElseMsgBox ( ILLEGAL DIVIDE 0 )End IfCase 8If Abs(Val(Text1.Text) 1290 Then scientific.Text1.Text = Str(temp *
27、temp * temp)ElseMsgBox (OVERFLOW. V ALUE TOO LARGE )End IfCase 4Text1.Text = Str(fact(Val(Text1.Text)End Select13End SubPrivate Sub Command7_Click(Index As Integer)Select Case IndexCase 0memo = memo + Val(Text1.Text)Case 1memo = memo - Val(Text1.Text)Case 2memo = memo * Val(Text1.Text)Case 3If Val(T
28、ext1.Text) 0 Then memo = memo / Val(Text1.Text)ElseMsgBox (ILLEGAL. DIVIDE 0 ERROR )End IfCase 4Text1.Text = Str(memo)prev = Val(Text1.Text)Case 5memo = 0End SelectEnd SubPrivate Sub Command8_Click(Index As Integer) Select Case IndexCase 0 que(qt) = Val(Text1.Text) qt = qt + 1Case 1qv = qnext(qv) La
29、bel1.Caption = Str(que(qv) qv = qnext(qv)Case 2On Error GoTo anil que(qv) = que(qt - 1) Label1.Caption = Str(que(qv) qt = qt - 1Case 3Text1.Text = Label1.CaptionEnd Select14anil:End SubPrivate Sub Command9_Click(Index As Integer) Select Case IndexCase 0Text1.Text = Str(Rnd)Case 1 Text1.Text = 3.1415
30、92654Case 2 Text1.Text = 2.718281828Case 3 Text1.Text = 9.86Case 4Text1.Text = 6.625End Selectopnre = 0 If oflag = 0 Then Text1.Text = End Ifoflag = 1 End Sub Private Sub Command4_Click()dflag = 0prev = 0 oflag = 0 ind = 0opnre = 0 Text1.Text = 0End SubPrivate Sub Command5_Click() Unload Me EndEnd S
31、ubPrivate Sub ecopy_Click() Clipboard.Clear Clipboard.SetText Text1.SelText15End SubPrivate Sub ecut_Click()Clipboard.ClearClipboard.SetText Text1.SelTextText1.SelText = End SubPrivate Sub eexit_Click()Unload MeEnd SubPrivate Sub epaste_Click()Text1.Text = Text1.SelText = Clipboard.GetText()End SubP
32、rivate Sub eselectall_Click()Clipboard.ClearClipboard.SetText Text1.TextEnd SubPrivate Sub Form_KeyPress(KeyAscii As Integer)If KeyAscii = Asc(.) Theni = 10Command1_Click (i)BeepElseIf KeyAscii = Asc(0) Theni = 0Command1_Click (i)BeepElseIf KeyAscii = Asc(1) Theni = 1Command1_Click (i)BeepElseIf Key
33、Ascii = Asc(2) Theni = 2Command1_Click (i)BeepElseIf KeyAscii = Asc(3) Theni = 316Command1_Click (i) BeepElseIf KeyAscii = Asc(4) Then i = 4Command1_Click (i) BeepElseIf KeyAscii = Asc(5) Then i = 5Command1_Click (i) BeepElseIf KeyAscii = Asc(6) Then i = 6Command1_Click (i) BeepElseIf KeyAscii = Asc
34、(7) Then i = 7Command1_Click (i) BeepElseIf KeyAscii = Asc(8) Then i = 8Command1_Click (i) BeepElseIf KeyAscii = Asc(9) Then i = 9Command1_Click (i) BeepElseIf KeyAscii = Asc(0) Then i = 0Command1_Click (i) BeepElseIf KeyAscii = Asc(+) Then i = 0Command2_Click (i) BeepElseIf KeyAscii = Asc(+) Then i = 0Command2_Click (i) BeepElseIf KeyAscii = Asc(-) Then i = 1Comma
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 《義務(wù)教育法》知識考試復(fù)習(xí)題庫(含答案)
- (技師)化學(xué)檢驗(yàn)工職業(yè)技能鑒定理論考試題庫(含答案)
- 年產(chǎn)1000噸納米復(fù)合氧化鋯項(xiàng)目可行性研究報(bào)告寫作模板-申批備案
- 2025年江西外語外貿(mào)職業(yè)學(xué)院高職單招職業(yè)適應(yīng)性測試近5年??及鎱⒖碱}庫含答案解析
- 2025年新疆工業(yè)職業(yè)技術(shù)學(xué)院高職單招職業(yè)技能測試近5年??及鎱⒖碱}庫含答案解析
- 幼兒園月亮故事活動策劃方案五篇
- 標(biāo)線承包合同范本
- 精準(zhǔn)醫(yī)療項(xiàng)目研發(fā)合作合同
- 麻雀的聽評課記錄
- 承攬貨物運(yùn)輸合同范本
- 房地產(chǎn)調(diào)控政策解讀
- 產(chǎn)前診斷室護(hù)理工作總結(jié)
- 2024-2025學(xué)年八年級數(shù)學(xué)人教版上冊寒假作業(yè)(綜合復(fù)習(xí)能力提升篇)(含答案)
- 《AP內(nèi)容介紹》課件
- 醫(yī)生定期考核簡易程序述職報(bào)告范文(10篇)
- 安全創(chuàng)新創(chuàng)效
- 《中國糖尿病防治指南(2024版)》更新要點(diǎn)解讀
- 初級創(chuàng)傷救治課件
- 部編版語文四年級下冊第一單元 迷人的鄉(xiāng)村風(fēng)景 大單元整體教學(xué)設(shè)計(jì)
- 湖南省長郡中學(xué)2023-2024學(xué)年高二下學(xué)期寒假檢測(開學(xué)考試)物理 含解析
- 五年級行程問題應(yīng)用題100道
評論
0/150
提交評論