㈠ 計算機vb編程題目
Private Sub Command1_Click()
Dim a, c As Integer
c = 0
a = Val(Text1.Text)
If a > 100 Then
c = (a - 100) * 0.45 + 50 * (0.35 + 0.25)
ElseIf a > 50 Then
c = (a - 50) * 0.35 + 50 * 0.25
ElseIf a <= 50 Then
c = a * 0.25
End If
Text2.Text = c
End Sub
在窗體上添加一個按鈕和兩個文本框,Text1用來輸入重量,Text2用來得出運價
㈡ 計算機vb編程題
open "d:\data1.txt" for output as #1
print #1,數據1 '保存一行
print #1,數據2 '再保存一行
close #1
㈢ 計算機VB編程題
PrivateSubForm_Click()
Fori=33To127
Printi;Chr(i),
IfiMod7=6ThenPrint
Nexti
EndSub
㈣ 計算機VB編程題 輸出100~200不能被3整除的數,每行輸出6個,分多行輸出。
PrivateSubCommand1_Click()
DimiAsInteger,nAsInteger
Fori=100To200
IfiMod3<>0Then
n=n+1
Printi;
IfnMod6=0Then
EndIf
EndIf
Next
EndSub
㈤ 計算機編程vb題
因為第一個數已經在上面代碼的第三行那裡輸入了啊,所以下面循環這里就只需要輸入9個數了。
其實程序可以優化一下:
DimxAsInteger,iAsInteger,maxAsInteger,minAsInteger
Fori=1To10
x=Val(InputBox("請輸入第"&i&"個數"))
Ifi=1Ormax<xThenmax=x
Ifi=1Ormin>xThenmin=x
Next
Printmax,min
㈥ 求解:兩道計算機VB編程題目
2、
(1)
窮舉法,列出從1000到9999所有的4位數,分別測試其是否等於所分兩個兩位數和的平方。
(2)
計算結果:
2025=(20+25)^2
3025=(30+25)^2
9810=(98+10)^2
(3)
代碼如下:
Private Sub Command1_Click()
For i = 1000 To 9999
If ((i \ 100) + (i Mod 100)) ^ 2 = i Then
Print i; "=("; i \ 100; "+"; i Mod 100; ")^2"
End If
Next i
End Sub
3、
(1)
窮舉法,列出從1001到29999所有的自然數,分別測試其是否能同時被32和47整除。
(2)
由於47是質數,所以判斷這個數是否能被32和47的最小公倍數1504整除,如果能整除那麼這個數能同時被32和47整除。
代碼如下:
For i = 1001 To 29999
a = 32 * 47
If i Mod a = 0 Then
Print i
End If
Next i
(3)
計算結果:
1504 3008 4512 6016 7520 9024 10528 12032 13536 15040 16544 18048 19552 21056 22560 24064 25568 27072 28576
================
希望對你有所幫助!
㈦ 求計算機作業vb編程題
'第一題:
Private Sub Command1_Click()
Dim N As Long, H As Long, T As String
N = Val(InputBox("請輸入N的值"))
For i = 1 To N
H = H + i
T = T & i
If i < N Then T = T & "+"
Next
MsgBox T & "=" & H
End Sub
'第二題:
Private Sub Command2_Click()
Dim N As Long, H As Long, T As String
N = Val(InputBox("請輸入N的值"))
H = 1: T = "1+"
For i = 2 To N Step 2
H = H + i - (i + 1)
T = T & i & "-" & i + 1
If i < N - 1 Then T = T & "+"
Next
MsgBox T & "=" & H
End Sub
'第三題:
Private Sub Command3_Click()
Dim N As Long, H As Long, T As String
N = Val(InputBox("請輸入N的值"))
For i = 1 To N
H = H + i * (i + 1)
T = T & i & "*" & i + 1
If i < N Then T = T & "+"
Next
MsgBox T & "=" & H
End Sub
'第四題:
Private Sub Command4_Click()
Dim N As Long, H As Long, T As String
N = Val(InputBox("請輸入N的值"))
N = 2 * N - 1
H = 1
For i = 1 To N Step 2
H = H * i
T = T & i
If i < N - 1 Then T = T & "*"
Next
MsgBox T & "=" & H
End Sub
'第五題:
Private Sub Command5_Click()
Dim N As Long, H, T As String
H = 1
For i = 20 To 2 Step -2
H = H * i
T = T & i
If i > 2 Then T = T & "*"
Next
MsgBox T & "=" & H
End Sub
'第六題:
Private Sub Command6_Click()
For i = 1 To 9
If i Mod 2 <> 0 Then Print String(i, "*")
Next
End Sub
㈧ 歷年計算機二級vb考試真題
考研歷年真題資料網路網盤免費下載
鏈接: https://pan..com/s/1t0SUkI-X-BW4v7Isl0dk4w
通過不斷研究和學習歷年真題,為考生沖刺階段復習提分指點迷津,做真題,做歷年真題集,對照考綱查缺補漏,提高實戰素養,制定做題策略,規劃方向;