1、FontBold = True欢迎来到河南大学Private Sub Command3_Click()End2-10r = Text1.TextText2.Text = 3.14 * 2 * rText1.Text = Text2.Text = Text1.SetFocus2-11Private Sub Form_Load()河南大学欢迎您!Text1.FontName = Text1.FontSize = 50Text1.BackColor = vbYellowText1.ForeColor = vbBlue2-12Dim s As Strings = Text1.SelTextText2.
2、SelText = s2-13If Label1.Top -Label1.Height ThenLabel1.Top = Label1.Top - 100Label1.Top = Form1.Height3-2Dim n As IntegerRandomizen = Int(90 * Rnd) + 10)Print n3-3河南大学环境与规划学院FontSize = Int(71 * Rnd + 10)3-4n = Text1.TextText2.Text = Hex(Asc(Right(Text1.Text, 1)3-5Dim m As Datem = Text1.Textn = DateT
3、ext2.Text = n - m3-6Dim b As StringDim n As StringDim m As Stringm = Left(Text1, 1)n = Right(Text1, 1)b = Mid(Text1, 2, 1)Text2.Text = n & b & m3-7Private Sub Form_click()r = InputBox(请输入字符)Print Left(r, 1) & Mid(r, 3, 1) & Right(r, 1)3-8Label1.FontSize = Rnd * 40 + 10Label1.BackColor = RGB(Rnd * 25
4、6, Rnd * 256, Rnd * 256)Label1.ForeColor = QBColor(Int(16 * Rnd)3-9x = Shell(notepad.exe, 1)Shell mspaint.exe, 13-10r! = InputBox(请输入您的工资:a = r 100b = (r - 100 * a) 50c = (r - 100 * a - b * 50) 10d = (r - 100 * a - b * 50 - c * 10) 5e = (r - 100 * a - b * 50 - c * 10 - d * 5) 2f = r - 100 * a - b *
5、50 - c * 10 - d * 5 - e * 2您的工资是: & r100元张数: a50元张数: b10元张数: c5元张数: d2元张数: e1元张数: f4-1Dim p As Single, r As Single, n As Singlep = Text1r = Text2n = Text3s = p * (1 + r) nMsgBox 您的本息是: Round(s, 2)4-2Dim max As Single, min As Singlea!请输入第一个实数b!请输入第二个实数If a b ThenPrint a, bPrint b, aEnd If 4-3请输入年份If
6、a Mod 4 = 0 And a Mod 100 0 & a Mod 400 = 0 Then您刚刚输入的年份为闰年!您刚刚输入的年份不是闰年!4-4a=b=c!c=d! = b * b - 4 * a * cIf d = 0 Thenm! = (-b + Sqr(d) / (2 * a)n! = (-b - Sqr(d) / (2 * a) X1 = ; m, , X2= nr = (-b) / (2 * a)i = Sqr(Abs(-d) / (2 * a)X1 = r &+ Abs(i) &iX2 = -4-5Dim x!x = Text1If x 60 ThenText2 = 重考!
7、ElseIf x 70 Then及格! 80 Then中等! 90 Then良好!优秀!Text1 = 4-6Select Case xCase Is 60 70 80 90Case ElseEnd Select4-7s = InputBox(请输入年龄If s 30 Then您的年龄为 s, 请参加长跑运动ElseIf s 100 1-2+3-4+5-6+99-100= s4-12Dim m As Integerm% = InputBox(请输入正整数m(m=1)阶乘n% = InputBox(请输入正整数n(n=m)For m = m To nt = 1For i = 1 To mt =
8、t * iNext is = s + tNext m m!+(m+1)!+n!=4-13Dim a%Dim b%Dim c%For a = 1 To 20For b = 1 To 20For c = 1 To 20If a * a + b * b = c * c ThenPrint a, b, cNext cNext bNext a4-14For n = 1 To 500For i = 1 To n - 1If n Mod i = 0 Then s = s + iIf s = n Then Print i;s = 04-15Dim i As IntegerDim n As Longn = 1D
9、o While t 0.00001e = e + ti = i + 1n = n * it = 1 / nLoope的近似值是5-2Dim i%, ss = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)For i = 0 To 9If s(i) Mod 3 = 0 ThenPrint s(i); i5-3Option Base 1Dim x()x = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)t = x(1)For i = 1 To 9x(i) = x(i + 1)Print x(i);Nextx(10) = tPrint x(i)t
10、= x(10)For i = 9 To 1 Step -1x(i + 1) = x(i)x(1) = tFor i = 1 To 105-4Dim a(5, 5)For i = 1 To 5Sum = 0For j = 1 To 5a(i, j) = Int(Rnd * 51 + 10)Sum = Sum + a(i, j)Print a(i, j);Next jPrint SumIf i = j Then Print a(i, j);5-5Dim a() As IntegerDim Max As Integer, iMax As Integer, jMax As IntegerDim Min
11、 As Integer, iMin As Integer, jMin As IntegerM = InputBox(输入MN = InputBox(输入NReDim a(M, N)For i = 1 To MFor j = 1 To Na(i, j) = Int(Rnd * 900) + 100Max = a(1, 1): Min = a(1, 1)If a(i, j) Max Then Max = a(i, j): iMax = i: jMax = jf a(i, j) Min Then Min = a(i, j): iMin = i: jMin = jMax= Max, iMax= iMa
12、x, jMax= jMaxMin= Min, iMin= iMin, jMin= jMinErase a 5-6n = InputBox(nReDim a(n, n)For i = 1 To nFor j = 1 To nIf i = j Thena(i, j) = 1a(i, j) = 0Erase a5-7Dim x As VariantFor i = 1 To 7x(i) = x(i + 3)ReDim Preserve x(i)x = Array(1, 2, 3, 4, 5, 6, 7)or i = 1 To 75-8Private Sub Command1_Click(Index A
13、s Integer)Select Case IndexCase 1Text3 = Val(Text1) + Val(Text2)Case 2Text3 = Text1 - Text2Case 3Text3 = Text1 * Text2Case 4Text3 = Text1 / Text26-1Dim x As SingleDim y As SingleDim z As Singlex = InputBox(请输入圆柱体的半径y = InputBox(请输入圆柱体的高度volume x, y, z圆柱体的体积为 z6-2窗体模块Dim a!, b!, c!a = InputBox(b = In
14、putBox(c = volume(a, b)标准模块Function volume(r As Single, h As Single) As Singlevolume = 3.14 * r * r * hEnd Function6-3Dim y%请输入一个整数Call week(y)6-4Dim a As Integer, b As Stringb = week(a)Print bFunction week(s As Integer) As StringSelect Case sCase 0week = 星期日星期一星期二星期三星期四Case 5星期五Case 6星期六数据无效6-5Private Sub Form_cl
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1