北京郵電大學計算機實習報告

2021-04-09 02:42:47 字數 4187 閱讀 2933

計算機實習報告

一、 算術運算測試程式

題目要求:製作乙個可供小學數**算的程式,要求能計算0——100正數加減乘除四則運算,如結果為小數四捨五入保留小數點後兩位,根據輸入題數出題,題目應為隨機,每次應不一樣。

設計方案:

使用語言為:microsoft visual basic

開發工具為:microsoft visual studio 2008

在form1中進行編輯,利用button控制項,分別控制「加法運算」「減法運算」「乘法運算」「除法運算」和「綜合運算」。單擊控制項分別進入form1、2、3、4、5、6,分別進行編輯,利用textbox控制項隨機產生數字或者運算子以及用來填寫答案,利用button控制項來控制選項,利用table控制項顯示答案、錯誤提示等。

流程圖:

部分源**:

public class form1

private sub button1_click(byval sender as system.object, byval e as system.eventargs) handles button1.

click

me.hide()

form2.show()

end sub

private sub button2_click(byval sender as system.object, byval e as system.eventargs) handles button2.

click

me.hide()

form3.show()

end sub

private sub button3_click(byval sender as system.object, byval e as system.eventargs) handles button3.

click

me.hide()

form4.show()

end sub

private sub button4_click(byval sender as system.object, byval e as system.eventargs) handles button4.

click

me.hide()

form5.show()

end sub

private sub button5_click(byval sender as system.object, byval e as system.eventargs) handles button5.

click

me.hide()

form6.show()

end sub

end class

public class form2

public a as integer, c as integer, b as string, d as integer

private sub button1_click(byval sender as system.object, byval e as system.eventargs) handles button1.

click

a = int(100 * rnd())

c = int(100 * rnd())

d = (a + c)

textbox1.text = val(a)

textbox3.text = val(c)

textbox5.text = ""

end sub

private sub button2_click(byval sender as system.object, byval e as system.eventargs) handles button2.

click

if val(textbox5.text) = val(d) then

label1.text = "回答正確,繼續加油!"

else

label1.text = "不正確,再想想?加油!"

end if

end sub

private sub button3_click(byval sender as system.object, byval e as system.eventargs) handles button3.

click

label1.text = "答案是" & val(d) & ",你答對了麼?"

end sub

private sub button4_click(byval sender as system.object, byval e as system.eventargs) handles button4.

click

me.hide()

form1.show()

end sub

private sub picturebox1_click(byval sender as system.object, byval e as system.eventargs) handles picturebox1.

click

end sub

end class

public class form6

public num1, num2, k as integer

public op as string

public n, answer, score, yes, no, c as double 'num1和num2是產生的兩個隨機數,n為產生的題目數目,yes和no為答對和答對和答錯的題目數,score為分數op為運算子

private sub button2_click(byval sender as system.object, byval e as system.eventargs) handles button2.

click

num1 = int(rnd() * 101)

num2 = int(rnd() * 101)

op = int(rnd() * 4)

select case op

case 0

textbox2.text = "+"

answer = num1 + num2

case 1

textbox2.text = "-"

answer = num1 - num2

case 2

textbox2.text = "*"

answer = num1 * num2

case 3

textbox2.text = "/"

if num2 = 0 then

num2 = int(rnd() * 101)

do while num2 = 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

end if

end select

textbox1.text = num1

textbox3.text = num2

textbox4.text = "="

yes = 0

no = 0

n = yes + no

k = n + 1

label1.text = "當前第" & k & "道題"

end sub

private sub button3_click(byval sender as system.object, byval e as system.eventargs) handles button3.

click

if val(textbox5.text) = answer then

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

金工實習報告 北京郵電大學

金工實習報告 專業班級 組別姓名 北京交通大學工程訓練中心 2012年3月 鑄造實習報告 專業班級組別姓名 一 填空 1.常用手工造型方法有 和等。2.型砂應具備的主要效能有和等。3.型芯的主要作用是或 4.鑄件產生的主要缺陷有和等。二 填寫出鑄件裝配圖和帶澆注系統鑄件圖中各部分名稱 三 綜合分析 ...

西安郵電大學計算機院實習報告

西安郵電大學 計算機學院 參觀實驗室實習報告 專業名稱軟體工程 班級1501班 學生姓名劉益豪 學號04153011 指導教師王鑫 日期 6月14日 6月16日 通過這兩天的參觀實習,我對學校有了更深層的了解,不再像以前那樣僅僅侷限在外在認識上,並且在了解的過程中,我更感受到了自身知識的侷限性,這也...

北京郵電大學世紀學院

激勵大學生在志願服務中勵志成長 每次開學返校,北京郵電大學世紀學院的學生們,談起假期志願服務的那些事兒,乙個個激情洋溢。他們在志願服務中發揮各自的特長,分享回報社會 回報他人的幸福,擁有了成為社會主人翁的自信。學生於荔至隨學院 世紀青苗 支教團隊赴貴州凱里雷山縣烏江村烏江小學支教返校後,在交流心得時...