版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、【程序改錯】 題目:該程序?qū)崿F(xiàn)將輸入的 0 - 255 之間的正整數(shù)轉(zhuǎn)換成二進制數(shù)Option ExplicitPrivate Sub Form_Click()Const n = 8Dim a(n) As Integer, s As String, m As Integer, x As Integer x = Val(InputBox(" 請輸入一個 0 - 255 之間的正整數(shù): ") Print xFor m = 1 To n a(m) = x Mod 2 x = x / 2Next mFor m = n To 0 Step -1s = Str(a(m)Next mPr
2、int sEnd Sub 答案:=( 答案 1)=For m = 0 To n=( 答案 2)=x= x 2=或 =x= int(x/2)=( 答案 3)=s = s + Str(a(m)第 3 題 (1.0 分) 題號 :463' 【程序改錯】' 題目:以下程序功能是輸入三個數(shù),由大到小排序。Option ExplicitDim A As IntegerDim B As IntegerDim C As IntegerPrivate Sub Form_Click()輸入正整數(shù) ") 輸入正整數(shù) ")輸入正整數(shù) ")Dim nTemp As Inte
3、gerA = Val(InputBox("Please input first integer", "B = Val(InputBox("Please input second integer", "C = Val(InputBox("Please input third integer", "If A <= C ThennTemp = AA = BB = nTempEnd IfIf B <= C Then nTemp = A A = C C = nTempEnd IfIf A <= B
4、 Then nTemp = B B = C C = nTempEnd IfPrint "The integers in order is" A; B; C End Sub 答案:=( 答案 1)=If A <= B Then=或 =If B >= A Then=( 答案 2)=If A <= C Then=或 =If C >= A Then=( 答案 3)=If B <= C Then=或 =If C >= B Then第 4 題 (1.0 分) 題號 :127' 【程序改錯】' 題目:下面程序可輸出如下圖形:I*I*I*
5、I*I*Option ExplicitPrivate Sub Form_Click()Dim m As Integer, n As Integer, s As String, i As Integer, j As Integer n = 4m = 1一 H*Hs = "*"For i = 5 To 1 Step -1Print Spc(n)For j = 1 To 2 * m - 1 Print s;Next jPrintNext iEnd Sub 答案: =( 答案 1)=Print Spc(n);=或 =Print Spc(i);=或 =? Spc(n);=或 =? S
6、pc(i);=( 答案 2)=n = n - 1=或 =n = - 1+n=( 答案 3)=m = m + 1第 5 題 (1.0 分) 題號 :469' 【程序改錯】' 題目:已知一個函數(shù) f(x)=1000*sin(x) ,利用繪圖方法' 在圖片框中顯示其圖形。結(jié)果如圖 1Option ExplicitPrivate Const pi = 3.14159Private Sub Command1_Click()Dim x As IntegerPicture1.Scale (-pi, -1200)-(pi, 1200)For x = -pi To pi Step piP
7、icture1.PSet (x, 1000 * pi * Sin(x), vbRedNext xEnd Sub答案:=( 答案 1)=Dim x As Single=或 =Dim x!=( 答案 2)=For x = -pi To pi Step pi / 180=( 答案 3)=Picture1.PSet (x, 1000 * Sin(x), vbRed=或 =Picture1.PSet (x, Sin(x)*1000), vbRed 第 6 題 (1.0 分) 題號 :497' 【程序改錯】'題目:編程求一個十進制整數(shù)n的各位數(shù)字之和,設(shè)n為小于或等于5位的數(shù)。Option
8、 ExplicitPrivate Sub Form_Click()Dim N As Integer, Sum As Integer, S1 As String, S2 As StringDim i As Integer, Ch As StringSum = 0N = InputBox(" 輸入整數(shù) n")S1 = Str(N)S1 = RTrim(S1)For i = 1 To Len(S1)Ch = Mid(N, i, 1)Sum = Val(Ch)Next iPrint "該整數(shù)的各位數(shù)之和是: " SumEnd Sub 答案:=( 答案 1)=S1
9、 = Trim(S1) =或 =S1 = lTrim(S1) =( 答案 2)=Ch = Mid(S1, i, 1)=( 答案 3)=Sum = Sum + Val(Ch) =或 =Sum = Sum + Val(Ch)第 7 題 (1.0 分) 題號 :454' 【程序改錯】' 題目:本程序的功能是隨機產(chǎn)生的10 個兩位正整數(shù),并進行遞減排序。Option ExplicitPrivate Sub CreateRND()Dim Temp As IntegerDim I As IntegerDim N As IntegerDim X(10) As IntegerDim J As
10、IntegerN = 10Print "數(shù)據(jù): "For I = 1 To NX(I) = Int(Rnd() * 90)Print X(I);Next IPrintPrint "排序: "For I = 0 To N - 1For J = I + 1 To NIf X(I) > X(J) ThenTemp = X(I)X(J) = X(I)X(I) = TempEnd IfNext JPrint X(I);Next IPrintEnd SubPrivate Sub Command1_Click()CreateRNDEnd Sub 答案:=( 答案
11、 1)=X(I) = Int(10 + Rnd() * 90)=或 =X(I) = Int(10 + Rnd() * 90)=( 答案 2)=If X(I) < X(J) Then=或 =If X(I) <= X(J) Then=或 =If X(J) > X(I) Then=或 =If X(J) >= X(I) Then=( 答案 3)=temp = X(J)第 9 題 (1.0 分) 題號 :130' 【程序改錯】' 題目:以下程序段用于計算 5 的 N 次方。Option ExplicitPrivate Sub Form_Click()Dim n A
12、s Integer, k As Integer, s As Long n = InputBox(" Input n ")k = 0s = 0Do While k <= ns = s * 5k = k + 1NextPrint "5的 " "n 次方是 " sEnd Sub 答案:=( 答案 1)=k=1=( 答案 2)=s=1=( 答案 3)=Loop第 11 題 ( 1.0 分) 題號 :452' 【程序改錯】'題目:用自定義函數(shù)的方法求sum (x),求當-Kxwi時,' sum (x) =x/2 !
13、 +xA2/3!+xA3/4!+ +xAn/(n +1)!,'當 x1 或 x-1 時,函數(shù)值為 0。當 n=0 時,輸入數(shù)'據(jù)錯誤。X、N都是由用戶輸入。Option ExplicitPrivate Sub Command1_Click()Dim s As SingleDim n As Integer, x As Single, k As Integern = Val(InputBox("Please input a integer value:")x = Val(InputBox("Please input a single value:&qu
14、ot;)數(shù)據(jù)If n <= 0 Thenk = MsgBox("數(shù)據(jù)輸入錯誤! ", vbRetryCancel + vbExclamation, "輸入 ")Exit SubEnd Ifs = Sum(x, n)Print sEnd SubFunction Sum(x As Single, n As Integer)Dim i As Integer, ss As Longss = 1Sum = 0If x > 1 Or x < -1 ThenExit DoElseFor i = 2 To nss = ss * iSum = x A (
15、i - 1) / ssNext iEnd IfEnd Function答案:=(答案 1)=exit Function=(答案 2)=For i = 2 To n + 1=或=For i = 2 To 1+n=(答案 3)=sum = sum + x A (i - 1) / ss第 14 題 ( 1.0 分) 題號 :136' 【程序改錯】' 題目:程序功能為打印下列圖形:I*I*I*I*Option ExplicitPrivate Sub Form_Click()ClsDim i As IntegerDim j As IntegerFor i = 1 To 7For j =
16、1 To 5Print "*"LoopPrintNext iEnd Sub 答案:=( 答案 1)=For i = 1 To 5=( 答案 2)=For j = 1 To i=( 答案 3)=Next j =或 =Next第 16 題 ( 1.0 分) 題號 :461' 【程序改錯】' 題目:產(chǎn)生 30 個小于 100 的成績隨機數(shù),并統(tǒng)計出優(yōu)、良 ' 、中等、及格、不及格數(shù)的個數(shù),并計算出成績屬' 于優(yōu)秀段的成績平均分。Option ExplicitPrivate Sub Form_Click()Dim k%, a%, bjg%, jg%,
17、 zd%, lh%, yx As IntegerDim pjf As IntegerRandomizepjf = 0For k = 1 To 30a = Int(Rnd()Select Case aCase 0 To 59bjg = bjg + 1 '不及格Case 60 To 69jg = jg + 1 '及格Case 70 To 79zd = zd + 1 ' 中等 Case 80 To 89lh = lh + 1 'Case 90 To 100 yx = yx + 1 '良好優(yōu)秀pjf = pjf + 1 End SelectNext kIf yx
18、 > 0 Then pjf = pjf / 30Debug.Print" 不及格 " + Str$(bjg) + " 人,及格 " + Str$(jg) + " 人,中等 " + Str$(zd)+ " 人"Debug.Print "良好 " + Str$(lh) + "優(yōu)秀 " + Str$(yx) + "人 "Debug.Print "優(yōu)秀分數(shù)段成績平均分 " & pjfEnd Sub 答案: =( 答案 1)= a
19、= Int( Rnd() * 100) =或 = a = Int( Rnd * 100) =( 答案 2)= pjf = pjf + a =( 答案 3)= If yx > 0 Then pjf = pjf / yx 第 17 題 ( 1.0 分) 題號 :456 ' 【程序改錯】 ' 題目:挑選單數(shù)并排序程序:程序啟動后由計算機自動產(chǎn) '生 20 個屬于 100 ,300 之間的隨機整數(shù),單擊 "顯' 示全體 " 按鈕時,在 Form1 上顯示這 20 個隨機數(shù); '單擊 "顯示奇數(shù) "按鈕時,在 Form
20、1 上顯示其中的奇數(shù);'單擊"排序"按鈕時,在Forml上將這些奇數(shù)從小到大顯示。'要求顯示格式為每行顯示 5 個數(shù)據(jù)。Option ExplicitPrivate a(20) As Integer, b(20) As IntegerPrivate k As IntegerPrivate Sub cmdodd_Click()Dim I As Integer k = 0For I = 1 To 20If a(I) / 2 = Int(a(I) / 2) Thenk = k + 1b(k) = a(I)End IfNext IFor I = 1 To kPrin
21、t b(I);If Int(I / 5) <> I / 5 Then Print Next IPrintEnd SubPrivate Sub cmdAll_Click()RandomizeDim I As IntegerFor I = 1 To 20a(I) = Int(Rnd() * 20 + 100)Print a(I),If Int(I / 5) = I / 5 Then PrintNext IPrintEnd SubPrivate Sub cmdsort_Click()Dim I As IntegerDim J As IntegerDim Temp As IntegerFo
22、r I = 1 To k - 1For J = I To kIf b(I) > b(J) Then Temp = b(I): b(I) = b(J): b(J) = Temp Next JNext IFor I = 1 To kPrint b(I);If Int(I / 5) = I / 5 Then PrintNext IEnd Sub 答案: =( 答案 1)= If a(I) / 2 <> Int(a(I) / 2) Then =或 = If a(I) mod 2 <>0 Then =或 = If 0<>a(I) mod 2 Then =或 =
23、If a(I) / 2 <> a(I) 2 Then =或 = If int(a(I) / 2) <> a(I) / 2 Then =或 = If a(I) 2 <> a(I)/2 Then =( 答案 2)= If Int(I / 5) = I / 5 Then Print =或 = If I mod 5 = 0 Then Print =或 = If 0 = I mod 5 Then Print =或 = If I / 5= int(I / 5) Then Print =或 =If I / 5= I 5 Then Print=或 =If I 5= I/ 5
24、 Then Print=( 答案 3)=a(I) = Int(Rnd() * 200 + 100)第 19 題 ( 1.0 分) 題號 :499' 【程序改錯】' 題目 : 編程將一個數(shù)從已經(jīng)有序(設(shè)從小到大排序)的數(shù)組'中刪除,使數(shù)組還繼續(xù)保持有序而且其余元素按照下'標連續(xù)存放。Option ExplicitPrivate Sub Form_Click()Dim A() As Integer, N As Integer, Flag As IntegerDim i As Integer, X As Integer, P As IntegerFlag = 0N =
25、 InputBox(" 輸入元素個數(shù) ")Dim A(N)For i = 1 To NA(i) = InputBox("輸入數(shù)組的第 " & i & " 個元素 ")Next iPrint "刪除某元素前的數(shù)組 "For i = 1 To NPrint A(i);Next iStart:X = InputBox(" 輸入要刪除的元素: ")For i = 1 To NIf X = A(i) Then P = i: Flag = 1Next iIf Flag = 0 Then Ms
26、gBox ("沒有此元素 "): GoTo StartFor i = P To N - 1A(i + 1) = A(i)Next iN = N + 1Print "刪除元素后的數(shù)組 :"For i = 1 To NPrint A(i);Next iEnd Sub答案:=( 答案 1)=ReDim A(N)=( 答案 2)=A(i) = A(i + 1)=或 =A(i) = A(1 + i)=( 答案 3)=N = N - 1第 20 題 ( 1.0 分) 題號 :139' 【程序改錯】' 題目:隨機產(chǎn)生并輸出 100 以內(nèi)大于 50 的
27、20 個整數(shù),輸' 出時每 5 個數(shù)一行。Option ExplicitPrivate Sub Form_Click()Randomize TimerDim i As Integer, ma As Integeri = 1Do Until i < 20ma = Rnd() * 100 1If ma > 50 ThenPrint ma;i = i + 1If i 5 = 0 ThenPrintEnd IfEnd IfLoopEnd Sub 答案: =( 答案 1)=i = 0=( 答案 2)=Do while i < 20=或 =Do while 20 > i=或
28、 =Do while i <=19=或 =Do while 19 > =i=( 答案 3)=If i mod 5 = 0 Then第 23 題 ( 1.0 分) 題號 :474' 【程序改錯】' 題目 : 程序功能為求解一元二次方程的實根,請修正程序中錯誤。 Option ExplicitPrivate Sub Form_Load()Dim a!, b!, c!, root1#, root2#, work As Doublea = Val(InputBox("請輸入系數(shù) a 的值 ")b = Val(InputBox("請輸入系數(shù) b
29、的值 ")c = Val(InputBox("請輸入系數(shù) c 的值 ")work = b * 2 - 4 * a * cIf work >= 0 And a <> 0 Thenroot1 = (Sqr(work) / (2 * a)root2 = (Sqr(work) / (2 * a)Debug.Print " 有二個實根 " + Str$(root1) + "," + Str$(root2) ElseDebug.Print " 無實根 !"End IfEnd Sub答案:=( 答案
30、1)=work = b A 2 - 4 * a * c=或=work = b *b - 4 * a * c=( 答案 2)=root1 = (-b + Sqr(work) / (2 * a)=或=root1 = ( Sqr(work) -b ) / (2 * a)=或=root1 = (-b + Sqr(work) / ( a*2)=或=root1 = ( Sqr(work) -b ) / ( a*2)=( 答案 3)=root2 = (-b - Sqr(work) / (2 * a)=或=root2 = (- Sqr(work) - b) / (2 * a)=或=root2 = (-b -
31、Sqr(work) / ( a*2)=或=root2 = (- Sqr(work) - b) / (a*2)第 28 題 (1.0 分) 題號 :133' 【程序改錯】' 題目:下面程序?qū)?10 個整數(shù)從大到小排序Option ExplicitPrivate Sub Form_Click()Dim t%, m%, n%, w%Dim a(10) As IntegerFor m = 1 To 10a(m) = Int(10 + Rnd() * 90)Print a(m); " "Next mPrintFor m = 1 To 9t = mFor n = 2 T
32、o 10If a(t) > a(n) Then n = tNext nIf t = m Thenw = a(m)a(m) = a(t)a(t) = wEnd If Next m For m = 1 To 10Print a(m) Next m End Sub 答案: =( 答案 1)= For n = m + 1 To 10 =( 答案 2)= If a(t) <a(n) Then t = n =或 = If a(n) >a(t) Then t = n =( 答案 3)= If t <> m Then =或 = If not t = m Then =或 = If
33、not m = t Then 第 30 題 ( 1.0 分) 題號 :480 ' 【程序改錯】'題目:下面函數(shù)的功能是:求變量 s(s=a+aa+aaa+aaaa ' 的值。其中,a是一個0-9的數(shù)字,總共累加 a項。 ' 例如,當a=3時,s=3+33+333 ( 共累加3項)。 Option ExplicitPublic Function Calc(a As Integer) Dim s As Long Dim t As Long Dim i As Integers = at = 1For i = 2 To at = t + a s = s + tNext
34、iCalc = sPrint sEnd FunctionPrivate Sub Command1_Click()Dim i As Integeri = InputBox(" 請輸入數(shù)字( 0-9):")Calc call iEnd Sub 答案:=(答案 1)= t = a=( 答案 2)=t = t * 10 + a=或 =t = t * 10 + a=或 =t = t * 10 + a=( 答案 3)=Calc i=或 =Call Calc(i)=或 =Calc (i)第 31 題 ( 1.0 分) 題號 :489程序改錯】' 題目 : 給定三角形的三條邊,計算
35、三角形的面積。要求' 程序首先判斷給定的三條邊能否構(gòu)成三角形。Option ExplicitPrivate Sub Form_Click()Dim a As Single, b As Single, c As SingleDim s As Single, t As Single start:a =InputBox("輸入 1 邊長:")b =InputBox("輸入 2 邊長:")c =InputBox("輸入 3 邊長:")If a + b < c Or b + c < a ThenMsgBox ("
36、不能構(gòu)成三角形,請重新輸入個邊 ")GoTo startEnd Ift = (a + b) / 2s = Sqr(t - a) * (t - b) * (t - c)Print "該三角形的面積: " sEnd Sub答案:=( 答案 1)=If a + b < c Or b + c < a Or a + c < b Then =( 答案 2)=t = (a + b + c) / 2=或 =t = (a + b + c ) / 2=( 答案 3)=s = Sqr(t * (t - a) * (t - b) * (t - c) =或 =s = Sq
37、r( t * (t - a) * (t - b) * (t - c) )第 32 題 ( 1.0 分) 題號 :475程序改錯】題目: 本程序求 3100之間的所有素數(shù)(質(zhì)數(shù))并統(tǒng)計個數(shù); 同時將這些素數(shù)從小到大依次寫入順序文件 c:dataout.txt 素數(shù)的個數(shù)顯示在窗體 Form1 上。Option ExplicitPrivate Sub Command1_Click()Dim Count As Integer, Flag As BooleanDim t1 As Integer, t2 As IntegerOpen "dataout.txt" For Input A
38、s #1Count = 0For t1 = 3 To 100Flag = TrueFor t2 = 2 To Int(Sqr(t1)If t1 Mod t2 = 0 Then Flag = False Next t2If Flag = False ThenCount = Count + 1Write #1, t2End IfNext t1Form1.Print " 素數(shù)個數(shù) " CountClose #1End Sub答案:=( 答案 1)=Open "dataout.txt" For Output As #1 =或 =Open "dataou
39、t.txt" For Output As 1 =( 答案 2)=If Flag Then=或 =If Flag=true Then=( 答案 3)=Write #1, t1=或 =Write 1, t1第 33 題 ( 1.0 分) 題號 :137程序改錯】'題目:求 s=72+102+132+832 的值。Option ExplicitPrivate Sub Form_Click() ClsDim s As Long Dim i As Integer s = 1For i = 7 To 832 s = s + i loop 30 Print s End Sub 答案: =(
40、 答案 1)= s =0=( 答案 2)= For i = 7 To 832 step 30 =( 答案 3)= Next i=或 = Next第 35 題 ( 1.0 分) 題號 :131程序改錯】' 題目:下面程序用于將十個數(shù)字從小到大排序Option ExplicitOption Base 1Private Sub Form_Click()ClsDim a(10) As IntegerDim i As Integer, j As Integer, temp As IntegerFor i = 0 To 10If i Mod 2 = 0 Then a(i) = i Else a(i
41、) = -i Print a(i);NextPrintFor i = 1 To 10For j = 1 To 10 - iIf a(j) < a(j + 1) Thentemp = a(j): a(j) = a(j + 1): a(j + 1) = temp End IfNext i, jFor i = 1 To 10Print a(i);NextEnd Sub 答案:( 答案 1)For i = 1 To 10=( 答案 2)=If a(j) > a( j + 1 ) Then =或 =If a( j + 1 ) <a (j) Then=( 答案 3)=Next j, i第
42、 40 題 ( 1.0 分) 題號 :141程序改錯】題目:輸出 40以內(nèi)能夠被 3 整除的數(shù),要求輸出結(jié)果為 5 個數(shù)一行。Option ExplicitPrivate Sub Form_Click()ClsDim x As IntegerDim i As Integeri = 1For x = 1 To 40If (x / 3) = (x 3) ThenPrint xi = i + 1End IfIf i Mod 3 = 0 ThenPrintEnd IfNext xEnd Sub 答案: =( 答案 1)=i = 0=( 答案 2)=Print x;=( 答案 3)=if i mod 5
43、=0 then第 42 題 ( 1.0 分) 題號 :117程序改錯】題目:下面的程序段用于實現(xiàn)以下功能:建立一順序文 件,存放 10 名同學(xué)的學(xué)號和三門功課成績,顯示 該文件內(nèi)所有記錄, 并同時顯示其總分和平均分Option ExplicitPrivate Sub Form_Click()Dim no%, c1%, c2%, c3%, i As IntegerOpen "c:2.txt" For Input As #1For i = 1 To 10no = InputBox(" c1 = InputBox(" c2 = InputBox("
44、c3 = InputBox("請輸入學(xué)號 ") 請輸入數(shù)學(xué)成績 ") 請輸入語文成績 ") 請輸入外語 ")Write #1, no, c1, c2, c2Next iClose #1Open "c:2.txt" For Output As #1For i = 1 To 10Print #1, no, c1, c2, c3Print no, c1, c2, c3, c1 + c2 + c3, (c1 + c2 + c3) / 3 Next iClose #1End Sub答案:=( 答案 1)= Open "c:2
45、.txt" For Output As #1 =( 答案 2)= Open "c:2.txt" For Input As #1 =( 答案 3)= Input #1, n0, c1, c2, c3 第 43 題 ( 1.0 分) 題號 :118程序改錯】題目:以下程序段用于輸出 100-300 的所有素數(shù)Option ExplicitPrivate Sub Form_Click()Dim n As Integer, k As Integer, i As Integer, swit As Integer For n = 101 To 300 Step 2 k = I
46、nt(Sqr(n)i = 2swit = 1While swit = 0If n Mod i = 0 Thenswit = 1Elsei = i - 1End IfWend If swit = 0 ThenPrint n;End IfNext nEnd Sub 答案:=( 答案 1)= swit=0=( 答案 2)=While i <= k And swit = 0 =或 =While k>=i And swit = 0=( 答案 3)=i= i + 1第 45 題 ( 1.0 分) 題號 :135程序改錯】題目:程序功能:求 1+2+3,直到其和超出 3000為 止,并輸入結(jié)果。
47、Option Explicit Private Sub Form_Click() ClsDim i As Integer Dim s As Single i = 1 s = 1 Doi = i + 2 s = s + i Loop s > 3000 Print " 從 1 到:" i; " 的和是 " s End Sub 答案:=(答案 1)= s =0=( 答案 2)=i = i + 1 =( 答案 3)= Loop until s > 3000 =或 = Loop until 3000 < s 第 46 題 ( 1.0 分) 題號
48、:144程序改錯】題目:下面程序的作用是產(chǎn)生 100以內(nèi)的全部素數(shù),并 按每行 5 個數(shù)據(jù)輸出。Option ExplicitPrivate Function prime(ByVal n As Integer) Dim i As Integerprime = 1If n <= 1 Then prime = 0For i = 1 To n - 1If n Mod i = 0 Then prime = 0Next iEnd FunctionPrivate Sub Form_Click()Dim i As Integer, k As Integerk = 0For i = 1 To 100If
49、 prime(i) = 1 ThenPrint Tab(k Mod 5) * 8); ik = k + 1If k Mod 4 = 0 Then Print ;End IfNext iEnd Sub 答案:=( 答案 1)=For i = 2 To n - 1=( 答案 2)=Print Tab( (k Mod 5) * 8 ); i; =( 答案 3)=If k Mod 5 = 0 Then Print 第 51 題 ( 1.0 分) 題號 :482程序改錯】題目: 請根據(jù)下列描述編寫購物優(yōu)惠程序。某商場為了 加速促成商品流通,采用購物打折的優(yōu)惠辦法,每 位顧客一次購物( 1 )在 100
50、元以上者,按九五折優(yōu)惠; (2)在 200元以上者,按九折優(yōu)惠; (3)300 元以上 者,按八折優(yōu)惠; ( 4) 500 元以上者按七折優(yōu)惠。Option ExplicitPrivate Sub Command1_Click() Dim x As Single, y As Single x = Val(Text1.Text)If x < 100 Thenx = yElseIf x < 200 Theny = 0.95 * xElseIf x < 300 Then y = 0.9 * xElseIf x < 500 Then y = 0.8 * xElsey = 0.7
51、 * xElse IfEnd IfEnd IfEnd IfText2.Text = xEnd Sub 答案:=( 答案 1)=y = x=( 答案 2)=End If=( 答案 3)=Text2.Text = y=或 = Text2 = y第 52 題 ( 1.0 分) 題號 :450程序改錯】' 題目:統(tǒng)計一順序文件 text.txt 中的空格、字母、數(shù)字和其它字符個數(shù)。Option ExplicitPrivate Sub Command1_Click()Dim s As String, C As StringDim I As Integer, L As Integer, spac
52、As Integer, character As Integer, digit As Integer, other As IntegerOpen App.Path & "text.txt" For Output As #1Do Until EOF(0)Line Input #1, sL = Len(s)For I = 1 To LC = Mid(s, I, 1)If C >= "a" And C <= "z" Or C >= "A" And C <= "Z" Then character = character + 1ElseIf C = " " Thenspac = spac + 1ElseIf C >= "0" And C < &
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 七年級上學(xué)期語文第一次月考試卷-6
- 楚雄彝族自治州八年級上學(xué)期語文期末試題
- 雇人干活免責協(xié)議書(2篇)
- 音樂課件制作教學(xué)課件
- 統(tǒng)計分析軟件模擬試題二及答案
- 南京工業(yè)大學(xué)浦江學(xué)院《太極推手》2022-2023學(xué)年第一學(xué)期期末試卷
- XX制藥活動中心消防水施工組織設(shè)計
- 飛向藍天的恐龍說課稿
- 《自相矛盾》說課稿
- 《因式分解》說課稿
- 消防安全培訓(xùn)內(nèi)容
- 2024-2030年辣椒種植行業(yè)市場深度分析及發(fā)展策略研究報告
- 變電站綠化維護施工方案
- 校園展美 課件 2024-2025學(xué)年人美版(2024)初中美術(shù)七年級上冊
- 2024版《糖尿病健康宣教》課件
- ktv保安管理制度及崗位職責(共5篇)
- 腦出血試題完整版本
- 義務(wù)教育信息科技課程標準(2022年版)考試題庫及答案
- 建筑施工安全生產(chǎn)責任書
- 新員工三級安全教育考試試題參考答案
- 公司年會策劃及執(zhí)行服務(wù)合同
評論
0/150
提交評論