VB科学计算器课程设计.docx
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《VB科学计算器课程设计.docx》由会员分享,可在线阅读,更多相关《VB科学计算器课程设计.docx(15页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、VB科学计算器课程设计 湖南医药学院 VB计算器课程设计题目: VB科学计算器 院(系)别临床医学院 专业临床医学 班级本临一班 学号 2022101010121 姓名夏铭锴 指导教师李跃强 二一六年四月 目录 一、设计内容及要求 二、设计原始资料 三、设计完成后提交的文件和图表设计 四、进程安排 五、主要参考资料 摘要 用VB制作这个程序的简单计算器,它包括一个标准的计算器和一个科学计算器。它可以实现简单的加减乘除四则运算,数字的平方、平方根,正弦、余弦、正切,倒数、指数函数、对数函数,角度、弧度、梯度的转换,以及各进制的相互转换。而且它的功能还有退格,清除当前数据,清除所有数据,复制数据,
2、粘贴数据。 在这个计算器的程序中,我用到了单行选择语句IfThenElse, 块语句ifthenend if,If语句的嵌套,多条件选择语句Select Case,而且还用到了按钮、文本框、框架、单选按钮控件,菜单的设计。 在此报告中我重点叙述了计算机的各个功能及用法。特别是进制间的转换和数字与运算符之间的联系。虽然描述的不太完整,但我会尽力使用系统结构图,划分多个模块,让大家明白我设计的运算器的功能的。 关键词 Visual Basic;计算器;对象;代码 1 2 3 四、进程安排 (1)创建应用程序的界面。 (2)设置属性。 (3)编写代码。 4 附页: 设计原始资料 Private Su
3、b Command1_Click() 删除数字的最后一位If Label3.Caption Then Label3.Caption = Left(Label3.Caption, Len(Label3.Caption) - 1) Else c = MsgBox(内容已为空!不可删除一位!, 49, 注意!) End If End Sub Private Sub Command10_Click() 输入数字6 Label3.Caption = Label3.Caption + Command10.Caption End Sub Private Sub Command11_Click() If La
4、bel3.Caption Then 输入符号* Label1.Caption = Label3.Caption Label2.Caption = Command11.Caption Label3.Caption = Else c = MsgBox(请输入数据后输入符号!, 49, 注意!) End If End Sub 5 Private Sub Command12_Click() 输入数字1 Label3.Caption = Label3.Caption + Command12.Caption End Sub Private Sub Command13_Click() 输入数字2 Label
5、3.Caption = Label3.Caption + Command13.Caption End Sub Private Sub Command14_Click() 输入数字3 Label3.Caption = Label3.Caption + Command14.Caption End Sub Private Sub Command15_Click() 输入符号 If Label2 Then Label3.Caption = -Val(Label3.Caption) Else Label1.Caption = Label3.Caption Label2.Caption = Command
6、15.Caption Label3.Caption = End If End Sub Private Sub Command16_Click() 输入数字0 Label3.Caption = Label3.Caption + Command16.Caption End Sub Private Sub Command17_Click() 输入小数点 Label3.Caption = Label3.Caption + Command17.Caption End Sub Private Sub Command18_Click() “=”按钮 If Label1.Caption Then If Lab
7、el2.Caption = * Then 计算乘法 Label3.Caption = Label1.Caption & * & Label3.Caption & = & Val(Label1.Caption) * Val(Label3.Caption) ElseIf Label2.Caption = / Then 计算除法 If Val(Label3.Caption) 0 Then Label3.Caption = Label1.Caption & / & Label3.Caption & = & Val(Label1.Caption) / Val(Label3.Caption) Else c
8、 = MsgBox(除数不能为0!请重新输入!, 49, 注意!) End If ElseIf Label2.Caption = - Then 计算减法 Label3.Caption = Label1.Caption & - & Label3.Caption & = & Val(Label1.Caption) - Val(Label3.Caption) ElseIf Label2.Caption = + Then 计算加法 Label3.Caption = Label1.Caption & + & Label3.Caption & = & Val(Label1.Caption) + Val(L
9、abel3.Caption) ElseIf Label2.Caption = mod Then 进行取余运算 6 If Label3.Caption = 0 Then c = MsgBox(除数不能为0! + Chr(13) + Chr(10) + 请重新输入!, 49, 提示!) Else Label3.Caption = Label1.Caption & mod & Label3.Caption & = & Val(Label1.Caption) Mod Val(Label3.Caption) End If ElseIf Label2.Caption = xy Then 计算xy Labe
10、l3.Caption = Label1.Caption & & Label3.Caption & = & Val(Label1.Caption) Val(Label3.Caption) End If Else If Label2.Caption = - Then 如果输入数字前输入“-”则按负数处理 Label3.Caption = -Val(Label3.Caption) End If End If Label1.Caption = Label2.Caption = Open App.Path & 记录 For Append As #1 保存记录 Print #1, 科学型计算器 & ; D
11、ate & ; Time() Print #1, Label3.Caption Print #1, Close #1 End Sub Private Sub Command19_Click() 输入符号+ If Label3.Caption Then Label1.Caption = Label3.Caption Label2.Caption = Command19.Caption Label3.Caption = Else c = MsgBox(请输入数据后输入符号!, 49, 注意!) End If End Sub Private Sub Command2_Click() Label3.C
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- VB 科学 计算器 课程设计
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内