北京邮电大学计算机实习报告.docx
《北京邮电大学计算机实习报告.docx》由会员分享,可在线阅读,更多相关《北京邮电大学计算机实习报告.docx(18页珍藏版)》请在冰豆网上搜索。
![北京邮电大学计算机实习报告.docx](https://file1.bdocx.com/fileroot1/2022-11/26/7255d9b8-e352-49e1-a00a-c7ece4920462/7255d9b8-e352-49e1-a00a-c7ece49204621.gif)
北京邮电大学计算机实习报告
计算机实习报告
一、算术运算测试程序
题目要求:
制作一个可供小学数学运算的程序,要求能计算0——100正数加减乘除四则运算,如结果为小数四舍五入保留小数点后两位,根据输入题数出题,题目应为随机,每次应不一样。
设计方案:
使用语言为:
MicrosoftVisualBasic
开发工具为:
MicrosoftVisualStudio2008
在Form1中进行编辑,利用Button控件,分别控制“加法运算”“减法运算”“乘法运算”“除法运算”和“综合运算”。
单击控件分别进入Form1、2、3、4、5、6,分别进行编辑,利用textbox控件随机产生数字或者运算符以及用来填写答案,利用Button控件来控制选项,利用table控件显示答案、错误提示等。
流程图:
部分源代码:
PublicClassForm1
PrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.Click
Me.Hide()
Form2.Show()
EndSub
PrivateSubButton2_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton2.Click
Me.Hide()
Form3.Show()
EndSub
PrivateSubButton3_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton3.Click
Me.Hide()
Form4.Show()
EndSub
PrivateSubButton4_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton4.Click
Me.Hide()
Form5.Show()
EndSub
PrivateSubButton5_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton5.Click
Me.Hide()
Form6.Show()
EndSub
EndClass
PublicClassForm2
PublicaAsInteger,cAsInteger,bAsString,dAsInteger
PrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.Click
a=Int(100*Rnd())
c=Int(100*Rnd())
d=(a+c)
TextBox1.Text=Val(a)
TextBox3.Text=Val(c)
TextBox5.Text=""
EndSub
PrivateSubButton2_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton2.Click
IfVal(TextBox5.Text)=Val(d)Then
Label1.Text="回答正确,继续加油!
"
Else
Label1.Text="不正确,再想想?
加油!
"
EndIf
EndSub
PrivateSubButton3_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton3.Click
Label1.Text="答案是"&Val(d)&",你答对了么?
"
EndSub
PrivateSubButton4_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton4.Click
Me.Hide()
Form1.Show()
EndSub
PrivateSubPictureBox1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesPictureBox1.Click
EndSub
EndClass
PublicClassForm6
Publicnum1,num2,kAsInteger
PublicopAsString
Publicn,answer,score,yes,no,cAsDouble'num1和num2是产生的两个随机数,n为产生的题目数目,yes和no为答对和答对和答错的题目数,score为分数op为运算符
PrivateSubButton2_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton2.Click
num1=Int(Rnd()*101)
num2=Int(Rnd()*101)
op=Int(Rnd()*4)
SelectCaseop
Case0
TextBox2.Text="+"
answer=num1+num2
Case1
TextBox2.Text="-"
answer=num1-num2
Case2
TextBox2.Text="*"
answer=num1*num2
Case3
TextBox2.Text="/"
Ifnum2=0Then
num2=Int(Rnd()*101)
DoWhilenum2=0
num2=Int(Rnd()*101)
Loop
c=num1/num2
answer=Int(100*(c+0.005))/100
Else
c=num1/num2
answer=Int(100*(c+0.005))/100
EndIf
EndSelect
TextBox1.Text=num1
TextBox3.Text=num2
TextBox4.Text="="
yes=0
no=0
n=yes+no
k=n+1
Label1.Text="当前第"&k&"道题"
EndSub
PrivateSubButton3_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton3.Click
IfVal(TextBox5.Text)=answerThen
yes=yes+1
RichTextBox1.Text=TextBox1.Text&TextBox2.Text&TextBox3.Text&"="&TextBox5.Text&"答案正确,继续努力!
"
Else
no=no+1
RichTextBox1.Text="不正确,继续努力!
正确答案是"&TextBox1.Text&TextBox2.Text&TextBox3.Text&"="&answer
n=yes+no
k=n+1
Label1.Text="当前第"&k&"道题"
n=yes+no
score=Int((yes/n+0.005)*100)
EndIf
TextBox5.Text=""
num1=Int(Rnd()*101)
num2=Int(Rnd()*101)
op=Int(Rnd()*4)
SelectCaseop
Case0
TextBox2.Text="+"
answer=num1+num2
Case1
TextBox2.Text="-"
answer=num1-num2
Case2
TextBox2.Text="*"
answer=num1*num2
Case3
TextBox2.Text="/"
Ifnum2=0Then
num2=Int(Rnd()*101)
DoWhilenum2=0
num2=Int(Rnd()*101)
Loop
c=num1/num2
answer=Int(100*(c+0.005))/100
Else
c=num1/num2
answer=Int(100*(c+0.005))/100
EndIf
EndSelect
TextBox1.Text=num1
TextBox3.Text=num2
TextBox4.Text="="
EndSub
PrivateSubButton5_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton5.Click
Me.Hide()
Form1.Show()
EndSub
PrivateSubButton4_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)
IfVal(TextBox5.Text)=answerThen
yes=yes+1
Else
no=no+1
EndIf
n=yes+no
score=Int((yes/n+0.005)*100)
EndSub
PrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.Click
MsgBox(n&"道题中共答对了"&yes&"道题,得分为"&score)
EndSub
PrivateSubPictureBox1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesPictureBox1.Click
EndSub
EndClass
程序行界面部分截图:
功能介绍:
本四则运算软件可以自由选择加法、减法、乘法、除法运算以及混合测试,适合不同程度的小学生。
在除四则运算外的部分,可以进行随机出题,并能查看提示,检查对错,直接返回主界面。
在四则运算部分,可以计算当前为第几道题,提交试卷后将会弹出对话框给出成绩。
并且,当答案输入为字符时,会认为该道题答案是错误的。
二、倒计时器
题目要求:
制作一个倒计时器,输入倒计时时间后,显示剩余时间,时间到后有提示音和提示画面。
支持倒计时的时间较宽,并且可以使用空格控制开始和停止。
设计方案:
使用语言为:
MicrosoftVisualBasic
开发工具为:
MicrosoftVisualBasic6.0中文版
利用timer控件、button控件、table以及textbox控件来实现程序。
流程图:
源代码
DimhAsInteger,mAsInteger,sAsInteger
PrivateSubCommand1_Click()
IfCommand2.Enabled=FalseThen
h=Int(Text1.Text)
m=Int(Text2.Text)
s=Int(Text3.Text)
Command1.Caption="停止"
Command2.Enabled=True
Timer1.Enabled=True
Else
Command1.Caption="开始"
Timer1.Enabled=False
h=0
m=0
s=0
Command2.Enabled=False
Label4.Caption=""
EndIf
EndSub
PrivateSubCommand2_Click()
IfTimer1.Enabled=TrueThen
Command2.Caption="继续"
Timer1.Enabled=False
Else
Command2.Caption="暂停"
Timer1.Enabled=True
EndIf
EndSub
PrivateSubCommand3_Click()
UnloadMe
EndSub
PrivateSubForm_Load()
Command1.Caption="开始"
Command2.Caption="暂停"
Command2.Enabled=False
Command3.Caption="退出"
Text1.Text="0"
Text2.Text="0"
Text3.Text="0"
Frame1.Caption="时间设置"
Form1.Caption="倒计时器"
Label4.Caption=""
Label5.Caption=""
Label6.Caption="当前时间"
Label7.Caption="倒计时:
"
Timer1.Enabled=False
WindowsMediaPlayer1.Controls.stop
EndSub
PrivateSubTimer1_Timer()
Label5.Caption=Time
IfCommand1.Caption="停止"Then
s=s-1
Label4.Caption=Str(h)+":
"+Str(m)+":
"+Str(s)
Ifs=-1Andm>0Then
m=m-1
s=59
Label4.Caption=Str(h)+":
"+Str(m)+":
"+Str(s)
EndIf
Ifm=0Andh>0Then
h=h-1
m=59
Label4.Caption=Str(h)+":
"+Str(m)+":
"+Str(s)
EndIf
Ifh=0Andm=0Ands=0Then
Command1.Enabled=True
Command2.Enabled=False
Timer1.Enabled=False
Label4.Caption="倒计时完成"
WindowsMediaPlayer1.Controls.play
MsgBox(倒计时完成)
WindowsMediaPlayer1.Controls.stop
Command1.Caption="开始"
EndIf
EndIf
EndSub
程序主要运行界面截图
功能介绍:
本软件可以进行较宽时间段内的倒计时,倒计时之中可以停止,可以重新计时且有声音提示。
三、动画
题目要求:
以每位同学自己为原型设计一组读书动画,时间不少于20秒,动作不重复,有故事情节,有背景音乐和与动作相符的配音。
设计方案:
使用软件为:
AdobeFlashCS4Professional
分图层创作,主要利用刷子绘图工具。
主要截图:
动画介绍:
在某一天,我读书途中遇到了问题。
百思而不得其解,十分烦闷。
但是突然,灵光一闪,我找到了答案,坐下来继续读书,翻页。