《软件设计基础(VB)》简单科学计算器课程设计报告书.docx
《《软件设计基础(VB)》简单科学计算器课程设计报告书.docx》由会员分享,可在线阅读,更多相关《《软件设计基础(VB)》简单科学计算器课程设计报告书.docx(22页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、河北联合大学?软件设计根底VB?课程设计报告设计名称: 简易科学计算器姓 名:学 号:专业班级:学 院:设计时间:设计地点:成绩:指导教师评语:指导教师签字:年 月 日Text 1 .Text =Text 1.Text = Text 1.Text & Indexlastinput = numEnd IfCommand 1 (O).SetFocus 0 获得焦点End SubPrivate Sub Command 10_Click() OFF 按钮,关闭程序EndEnd SubPrivate Sub Command! l_Click() CE 按钮,去除If Len(Textl.Text) =
2、1 ThenText 1.Text = Left(Textl.Text, Len(Textl.Text) - 1)ElseMsgBox ”已经是最后一位”,48, “提示”End IfEnd SubPrivate Sub Command 12_Click() -/+按钮Text 1 .Text = Trim(-Val(Text 1 .Text)End SubPrivate Sub Command 13_Click() x八2 按钮End SubPrivate Sub Command 14_Click()八进制按钮Text 1 .Text = Oct(Textl.Text)End SubPriv
3、ate Sub Command2_Click(Index As Integer)功能函数按钮将 x 转化为角度制Dim x As Double x 二 Val(Textl.Text)If Option2,Value = ture Then x = x * pi /180Select Case IndexCase 0 计算sin,以特定格式输出Text 1.Text = Format(Sin(x), O.#M) lastinput = num计算 expText 1.Text = 1() A Text 1.Textlastinput =numCase 1 计算 sqrIf Text 1.Text
4、 0 Then计算三角函数时判断条件Text 1 .Text = Format(Sqr(Val(Textl .Text), #.#)lastinput = numElseMsgBox ”被开方数不能为负数二48, “提示”Textl.SetFocusEnd IfCase 2 计算 cosText 1.Text = Format(Cos(x), ,0.#n) lastinput = numCase 3 计算 logText 1.Text = Log(textl.text) / Log( 10) lastinput = num Case 5计算 1/xIf x = 0 ThenMsgBox ”数据
5、输入不正确”,48, “提示”ElseTextl.Text = n0& 1 / Val(x) lastinput = num End If Case 6计算 tanText 1 .Text = Format(Tan(x), lastinput = num Case 7,计算 InText 1.Text = Log(Textl.Text) lastinput = num End SelectEnd SubPrivate Sub Command3_Click()冗按钮Text 1.Text = 3.1415926直接输出lastinput = numEnd SubPrivate Sub Comma
6、nd4_CIick() e 按钮Dim e As Double, i As Integer, j As Integer j 作为内循环的循环变量Dim dblFact As Double 存放阶乘结果的变量e = 2i= 1Do1 = i+ 1dblFact =初始化阶乘结果变量For j = 1 To i呐嵌套循环,求阶乘dblFact = dblFact * jNexte = e + 1 / dblFactLoop Until 1 / dblFact 1 / 10A 16,直至第 i 项的值 16 Or InStr(l, Text 1.Text, n.) 0 And lastinput e
7、qv ThenExit SubIf lastinput = opt Or lastinput = eqv Or lastinput = neg ThenText 1.Text = Text 1.Text + ”0.ElseText 1.Text = Text 1.Text +End Iflastinput = numEnd SubPrivate Sub Command9_Click()初始化Call Form_Loadoptnum = 0End SubPrivate Sub copy_Click(),菜单项的代码Clipboard.Clear清空剪贴板Clipboard.SetText Tex
8、t 1 .Text 将文本框内容放入剪贴板End SubPrivate Sub form_KeyPress(KeyAscii As Integer) ()-9 和”.键盘输入Textl.SetFocusTextl.Text = ,M,Dim i As IntegerIf KeyAscii = Asc(nO) Theni = 0Call Command 1 _Click(i)Elself KeyAscii = Asc(nl) Theni = 1Call Commandl_Click(i)Elself KeyAscii = AscC2) Theni = 2Command l_Click (i)El
9、self KeyAscii = Asc(n3) Theni = 3Commandl_Click (i)Elself KeyAscii = Asc(4) Theni = 4Command l_Click (i)Elself KeyAscii = Asc(”5”) Theni = 5Commandl_Click (i)Elself KeyAscii = Asc(6) Theni = 6Command l_Click (i)Elself KeyAscii = Asc(n7,) Theni = 7Command l_Click (i)Elself KeyAscii = Asc(“8)Then i =
10、8Command l_Click (i)Elself KeyAscii = Asc(9) Then i = 9Command l_Click (i)Elself KeyAscii = Asc(n.n) ThenCommand8_ClickEnd IfEnd Sub为窗体设置背景图片为窗体设置背景图片Private Sub Form_Load()窗体加载事件Form 1.Picture = LoadPicture(App.Path + nl.jpg) numl = 0 num2 = 0opttype = -1Textl.Text=nOnlastinput = eqvoptnum = 0eqvnu
11、m = 0End SubPrivate Sub paste_Qick()菜单项 粘贴 按钮Text 1.Text = Clipboard.GetText将剪贴板内容取出End SubPrivate Sub Textl_Click()Text 1 .Text”End SubPrivate Sub Text 1 _KeyPress(KeyAscii As Integer)运算符键盘输入Select Case Key AsciiCase Asc(”+)按下加号键Command6_Click (3),调用运算符单击事件过程Textl.Text =,nCaseAscC-)按下减号键IfTextl.Tex
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 软件设计基础VB 软件设计 基础 VB 简单 科学 计算器 课程设计 报告书
限制150内