欢迎来到天天文库
浏览记录
ID:57327925
大小:90.50 KB
页数:6页
时间:2020-08-12
《vb科学计算器实验报告.doc》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、西安科技大学可视化编程语言实验报告题目:科学计算器班级:学号:姓名:2010年11月复杂型科学计算器的设计与实现实验目的1.通过本实验,进一步理解VisualBasic的编程方法。2.提高运用VisualBasic编程的能力。3.培养对所学知识的综合运用能力。实验类型综合型。实验内容与步骤一.界面设计。对象属性设置对象名属性值Form1Caption科学计算器Command1CaptionSinindex0Command1Captioncosindex1Command1Captiontgindex2Command1Captionsecindex3C
2、ommand1Captioncscindex4Command1Captionctgindex5Command1CaptionSqrindex6Command1Caption1/aindex7Command1Captionarctgindex8Command1Captionarcctgindex9Command1Captionlogindex10Command1Captionlnindex11Command1Captionshindex12Command1Captionchindex13Command1Captionabsindex14Command
3、2Caption0index0Command2Caption1index1Command2Caption2index2Command2Caption3index3Command2Caption4index4Command2Caption5index5Command2Caption6index6Command2Caption7index7Command2Caption8index8Command2Caption9index9Command2Caption-index10Command2Caption.index11Command2Caption+in
4、dex12Command2Caption-index13Command2Caption*index14Command2Caption/index15Command2Caption(index16Command2Caption)index17Command2Caption^index18Command3Caption<-Command4CaptionCECommand5Caption=二.计算器界面:三.程序代码:Dimnum1AsSingle,num2AsSingleDimfuAsIntegerDimsignAsIntegerPrivateSubC
5、ommand1_Click(IndexAsInteger)SelectCaseIndexCase0To9sign=Index+20Case10sign=Index+20fu=1Case11To14sign=Index+20EndSelectText1.Text=""EndSubPrivateSubCommand2_Click(IndexAsInteger)SelectCaseIndexCase0To9Text1.Text=Text1.Text&IndexIffu=0Thennum1=Val(Text1.Text)Elsenum2=Val(Text1
6、.Text)EndIfCase10Text1.Text=Text1.Text&"-"Case11Text1.Text=Text1.Text&"."Case12To18Text1.Text=""sign=Indexfu=1EndSelectEndSubPrivateSubCommand3_Click()Iftext1.text=””thenelseText1.Text=Left$(Text1.Text,Len(Text1.Text)-1)EndifEndSubPrivateSubCommand4_Click()Text1.Text=""EndSubP
7、rivateSubCommand5_Click()DimnAsInteger,cfAsSinglefu=0:cf=1SelectCasesignCase12Text1.Text=num1&"+"&num2Text1.Text=num1+num2Case13Text1.Text=num1-num2Case14Text1.Text=num1*num2Case15Text1.Text=num1/num2Case18Forn=1Tonum2cf=cf*num1NextnText1.Text=cfCase20Text1.Text=Sin(num1)Case2
8、1Text1.Text=Cos(num1)Case22Text1.Text=Tan(num1)Case23Text1.Te
此文档下载收益归作者所有