欢迎来到淘文阁 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
淘文阁 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    VB计算器代码.doc

    • 资源ID:78792219       资源大小:55.50KB        全文页数:15页
    • 资源格式: DOC        下载积分:20金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要20金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    VB计算器代码.doc

    /calc/Frm_Scientific.frmVERSION 5.00Begin VB.Form Frm_Scientific Caption = "计算器" ClientHeight = 2925 ClientLeft = 165 ClientTop = 735 ClientWidth = 5595 LinkTopic = "Form1" LockControls = -1 'True MaxButton = 0 'False ScaleHeight = 2925 ScaleWidth = 5595 StartUpPosition = 3 '窗口缺省 Begin VB.CommandButton Cmd_Rnd Caption = "Rnd" Height = 390 Left = 5025 TabIndex = 39 Top = 1455 Width = 510 End Begin VB.CommandButton Cmd_PI Caption = "PI" Height = 390 Left = 1575 TabIndex = 38 Top = 2400 Width = 630 End Begin VB.CommandButton Cmd_Fact Caption = "N!" Height = 390 Left = 1575 TabIndex = 37 Top = 1935 Width = 630 End Begin VB.CommandButton Cmd_Log Caption = "Log" Height = 390 Left = 1575 TabIndex = 36 Top = 1455 Width = 630 End Begin VB.CommandButton Cmd_Ln Caption = "Ln" Height = 390 Left = 1575 TabIndex = 35 Top = 960 Width = 630 End Begin VB.CommandButton Cmd_Square Caption = "X2" Height = 390 Left = 840 TabIndex = 34 Top = 2400 Width = 630 End Begin VB.CommandButton Cmd_Cube Caption = "X3" Height = 390 Left = 825 TabIndex = 33 Top = 1935 Width = 630 End Begin VB.CommandButton Cmd_Operator Caption = "XY" Height = 390 Index = 5 Left = 840 TabIndex = 32 Top = 1455 Width = 630 End Begin VB.CommandButton Cmd_Exp Caption = "Exp" Height = 390 Left = 840 TabIndex = 31 Top = 960 Width = 630 End Begin VB.CommandButton Cmd_Sin Caption = "Sin" Height = 390 Left = 120 TabIndex = 30 Top = 960 Width = 630 End Begin VB.CommandButton Cmd_Cos Caption = "Cos" Height = 390 Left = 120 TabIndex = 29 Top = 1455 Width = 630 End Begin VB.CommandButton Cmd_Tan Caption = "Tan" Height = 390 Left = 120 TabIndex = 28 Top = 1935 Width = 630 End Begin VB.CommandButton Cmd_Atan Caption = "Atan" Height = 390 Left = 120 TabIndex = 27 Top = 2400 Width = 630 End Begin VB.Frame Frame1 Height = 510 Left = 90 TabIndex = 23 Top = 330 Width = 2625 Begin VB.OptionButton Otn_Grd Caption = "梯度" Height = 180 Left = 1695 TabIndex = 26 Top = 210 Width = 750 End Begin VB.OptionButton Otn_Rad Caption = "弧度" Height = 180 Left = 900 TabIndex = 25 Top = 210 Width = 795 End Begin VB.OptionButton Otn_Deg Caption = "角度" Height = 180 Left = 135 TabIndex = 24 Top = 210 Value = -1 'True Width = 675 End End Begin VB.CommandButton Cmd_Operator Caption = "=" Height = 390 Index = 4 Left = 5025 TabIndex = 22 Top = 2400 Width = 510 End Begin VB.CommandButton Cmd_Operator Caption = "+" Height = 390 Index = 3 Left = 4470 MaskColor = &H& Style = 1 'Graphical TabIndex = 21 Top = 2400 Width = 510 End Begin VB.CommandButton Command1 Caption = "." Height = 390 Index = 11 Left = 3915 TabIndex = 20 Top = 2400 Width = 510 End Begin VB.CommandButton Command1 Caption = "+/-" Height = 390 Index = 10 Left = 3360 TabIndex = 19 Top = 2400 Width = 510 End Begin VB.CommandButton Command1 Caption = "0" Height = 390 Index = 0 Left = 2820 TabIndex = 18 Top = 2400 Width = 510 End Begin VB.CommandButton Cmd_fraction Caption = "1/x" Height = 390 Left = 5025 TabIndex = 17 Top = 1935 Width = 510 End Begin VB.CommandButton Cmd_sqrt Caption = "Sqrt" Height = 390 Left = 5025 TabIndex = 16 Top = 960 Width = 510 End Begin VB.CommandButton Cmd_C Caption = "C" Height = 405 Left = 4785 TabIndex = 15 Top = 405 Width = 750 End Begin VB.CommandButton Cmd_CE Caption = "CE" Height = 405 Left = 3975 TabIndex = 14 Top = 405 Width = 750 End Begin VB.CommandButton Cmd_Backspace Caption = "Backspace" Height = 405 Left = 2820 TabIndex = 13 Top = 405 Width = 1110 End Begin VB.CommandButton Cmd_Operator Caption = "-" Height = 390 Index = 2 Left = 4470 TabIndex = 12 Top = 1935 Width = 510 End Begin VB.CommandButton Cmd_Operator Caption = "*" Height = 390 Index = 1 Left = 4470 TabIndex = 11 Top = 1455 Width = 510 End Begin VB.CommandButton Cmd_Operator Caption = "/" Height = 390 Index = 0 Left = 4470 TabIndex = 10 Top = 960 Width = 510 End Begin VB.CommandButton Command1 Caption = "9" Height = 390 Index = 9 Left = 3915 TabIndex = 9 Top = 960 Width = 510 End Begin VB.CommandButton Command1 Caption = "8" Height = 390 Index = 8 Left = 3360 TabIndex = 8 Top = 960 Width = 510 End Begin VB.CommandButton Command1 Caption = "7" Height = 390 Index = 7 Left = 2820 TabIndex = 7 Top = 960 Width = 510 End Begin VB.CommandButton Command1 Caption = "6" Height = 390 Index = 6 Left = 3915 TabIndex = 6 Top = 1455 Width = 510 End Begin VB.CommandButton Command1 Caption = "5" Height = 390 Index = 5 Left = 3360 TabIndex = 5 Top = 1455 Width = 510 End Begin VB.CommandButton Command1 Caption = "4" Height = 390 Index = 4 Left = 2820 TabIndex = 4 Top = 1455 Width = 510 End Begin VB.CommandButton Command1 Caption = "3" Height = 390 Index = 3 Left = 3915 TabIndex = 3 Top = 1935 Width = 510 End Begin VB.CommandButton Command1 Caption = "2" Height = 390 Index = 2 Left = 3360 TabIndex = 2 Top = 1935 Width = 510 End Begin VB.CommandButton Command1 Caption = "1" Height = 390 Index = 1 Left = 2820 TabIndex = 1 Top = 1935 Width = 510 End Begin VB.TextBox Txt_Result Alignment = 1 'Right Justify Height = 315 Left = 90 Locked = -1 'True TabIndex = 0 Text = "0." Top = 0 Width = 5385 End Begin VB.Menu Menu_Edit Caption = "编辑(&E)" Begin VB.Menu Menu_Copy Caption = "复制" Shortcut = C End Begin VB.Menu Menu_Paste Caption = "粘贴" Shortcut = V End Begin VB.Menu Menu_Cut Caption = "剪切" Shortcut = X End Begin VB.Menu line1 Caption = "-" End Begin VB.Menu Menu_All Caption = "全选" Shortcut = A End Begin VB.Menu line2 Caption = "-" End Begin VB.Menu Menu_Exit Caption = "退出" End End Begin VB.Menu Menu_Help Caption = "帮助(&H)" Begin VB.Menu Menu_HelpSubject Caption = "帮助主题(&H)" End Begin VB.Menu Menu_About Caption = "关于计算器" End EndEndAttribute VB_Name = "Frm_Scientific"Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = FalseOption ExplicitDim que(25) As DoublePublic qt As IntegerPublic qh As IntegerPublic qv As IntegerPublic ang As DoublePublic memo As DoubleDim dflag As IntegerDim i As IntegerDim opnre As IntegerDim prev As DoubleDim oflag As IntegerDim ind As IntegerPrivate Sub Cmd_Atan_Click() 'Atan函数 Txt_Result.Text = Str(Atn(Val(Txt_Result.Text) / ang) prev = Txt_Result.TextEnd SubPrivate Sub Cmd_Backspace_Click() '退格 If Txt_Result.Text = "0." Then Exit Sub End If If (Txt_Result.Text <> "") Then Txt_Result.Text = Mid(Txt_Result.Text, 1, Len(Txt_Result.Text) - 1) ElseIf Txt_Result.Text = "" Then Txt_Result.Text = "0." End IfEnd SubPrivate Sub Cmd_C_Click() '清零 Txt_Result.Text = "0" prev = 0End SubPrivate Sub Cmd_CE_Click() dflag = 0 prev = 0 oflag = 0 ind = 0 opnre = 0 Txt_Result = " 0"End SubPrivate Sub Cmd_Cos_Click() 'Cos值 Txt_Result.Text = Str(Cos(ang * Val(Txt_Result.Text) prev = Txt_Result.TextEnd SubPrivate Sub Cmd_Cube_Click() Txt_Result.Text = Val(Txt_Result.Text) 3 prev = Txt_Result.TextEnd SubPrivate Sub Cmd_Exp_Click() '计算Exp的值 Txt_Result.Text = Exp(Txt_Result.Text) prev = Txt_Result.TextEnd SubPrivate Sub Cmd_Fact_Click() 'N! Txt_Result.Text = Str(fac(Val(Txt_Result.Text) prev = Txt_Result.TextEnd SubPrivate Sub Cmd_fraction_Click() '倒数 Dim Temp Temp = Val(Txt_Result.Text) If Temp <> 0 Then Txt_Result.Text = Str(1 / Temp) Else Txt_Result.Text = "除数不能为零。" End If prev = Txt_Result.TextEnd SubPrivate Sub Cmd_Ln_Click() 'LN If Val(Txt_Result.Text) > 0 Then Txt_Result.Text = Str(Log(Val(Txt_Result.Text) Else Txt_Result.Text = "输入有误。" End If prev = Txt_Result.TextEnd SubPrivate Sub Cmd_Log_Click() 'Log If Val(Txt_Result.Text) > 0 Then Txt_Result.Text = Str(Log(Val(Txt_Result.Text) / Log(10) Else Txt_Result.Text = "输入有误。" End If prev = Txt_Result.TextEnd SubPrivate Sub Cmd_Operator_Click(Index As Integer) ' 单击操作符按钮 If opnre = 0 Or Index = 4 Then If ind = 3 Then '加号 prev = prev + Val(Txt_Result.Text) ElseIf ind = 2 Then '减号 prev = prev - Val(Txt_Result.Text) ElseIf ind = 0 Then '除号 If Val(Txt_Result.Text) = 0 Then Txt_Result.Text = "除数不能为零。" Exit Sub Else prev = prev / Val(Txt_Result.Text) End If ElseIf ind = 5 Then 'XY prev = prev Val(Txt_Result.Text) ElseIf ind = 1 Then '乘号 prev = prev * Val(Txt_Result.Text) End If If prev = 0 Then '如果前一个操作数为0 prev = Txt_Result.Text '将当前的值传给操作数 Else '否则 Txt_Result.Text = Str(prev) '将操作数的值传递给文本框显示 End If oflag = 0 End If opnre = 1 ind = Index dflag = 0End SubPrivate Sub Cmd_PI_Click() 'PI Txt_Result.Text = 3. prev = Txt_Result.TextEnd SubPrivate Sub Cmd_Rnd_Click() '产生一个随机数 Txt_Result.Text = Str(Rnd)End SubPrivate Sub Cmd_Sin_Click() 'Sin值 Txt_Result.Text

    注意事项

    本文(VB计算器代码.doc)为本站会员(飞****2)主动上传,淘文阁 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知淘文阁 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于淘文阁 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

    本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

    工信部备案号:黑ICP备15003705号 © 2020-2023 www.taowenge.com 淘文阁 

    收起
    展开