Автор: Пользователь скрыл имя, 16 Декабря 2012 в 19:27, курсовая работа
Задача № 1
Постановка задачи: Составить программу нахождения площади прямоугольника со сторонами Х и У.
Задача № 2
Постановка задачи: Составить программу перевода строки в нижний регистр.
..
Задача № 10
Постановка задачи: Составить программу рисования цифр 0-9 в псевдографике. Полученный рисунок сохранить в файл.
Вариант № 1
Задача № 1
Dim x As Integer, y As Integer, z As Integer
Private Sub Command1_Click()
Text3.Text = Text1 + Text2.Text
x = Text1.Text
y = Text2.Text
z = x * y: Text3.Text = z
End Sub
Private Sub Command2_Click()
Form1.Hide: Form2.Show
End Sub
Задача № 2
Dim x As String, y As String
Private Sub Command1_Click()
x = Text1.Text
y = LCase(x): Text2.Text = y
End Sub
Private Sub Command2_Click()
Form2.Hide: Form3.Show
End Sub
Private Sub Command3_Click()
Form2.Hide: Form1.Show
End Sub
Задача № 3
Dim x As Variant, y As Variant
Private Sub Command1_Click()
x = Text1.Text
y = (5 * (32 - x) / 9): Text2.Text = y
End Sub
Private Sub Command2_Click()
Form3.Hide: Form4.Show
End Sub
Private Sub Command3_Click()
Form3.Hide: Form2.Show
End Sub
Задача № 4
Dim x As Integer, y As Integer
Private Sub Command1_Click()
x = Text1.Text
y = Text2.Text
If (y < (x - 100) - 5) Or (y > (x - 100) + 5) Then MsgBox "Вес не в норме" Else MsgBox "Вес в норме"
End Sub
Private Sub Command2_Click()
Form4.Hide: Form5.Show
End Sub
Private Sub Command3_Click()
Form4.Hide: Form3.Show
End Sub
Задача № 5
Dim x As String, s As Integer
Private Sub Command1_Click()
x = Text1.Text
k = Len(x)
Select Case k
Case 1
s = 0
For i = 10 To 352
n = Len(i)
For j = 1 To n
For y = 1 To k
If Mid(x, y, 1) = Mid(i, j, k) Then s = s + 1
Next y
Next j
Next i
Case 2
s = 0
For i = 10 To 352
For j = 1 To k
If x = Mid(i, j, 2) Then s = s + 1
Next j
Next i
Case 3
s = 0
For i = 10 To 352
For j = 1 To k
If x = Mid(i, j, 3) Then s = s + 1
Next j
Next i
End Select
Text2.Text = s
End Sub
Private Sub Command2_Click()
Form5.Hide: Form6.Show
End Sub
Private Sub Command3_Click()
Form5.Hide: Form4.Show
End Sub
Задача № 6
Private Sub Command1_Click()
Dim x(19) As Integer
For y = 0 To 19
x(y) = MSFlexGrid1.TextMatrix(y, 0)
Next y
Dim max As Integer
Dim min As Integer
max = x(0)
min = x(0)
For i = 1 To 19
If max < x(i) Then
max = x(i)
End If
If min > x(i) Then
min = x(i)
End If
Next i
Text2.Text = min
Text3.Text = max
Text1.Text = max + min
End Sub
Private Sub Command2_Click()
Form6.Hide: Form5.Show
End Sub
Private Sub Command3_Click()
Form7.Show: Form6.Hide
End Sub
Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 48 To 57
MSFlexGrid1.Text = MSFlexGrid1.Text & Chr(KeyAscii)
Case 45
If Mid(MSFlexGrid1.Text, 1, 1) = "-" Then
MSFlexGrid1.Text = Mid(MSFlexGrid1.Text, 2, Len(MSFlexGrid1.Text) - 1)
Else
MSFlexGrid1.Text = "-" & MSFlexGrid1.Text
End If
End Select
End Sub
Задача № 7
Private Sub Command1_Click()
Dim a(6, 5) As Variant
Dim s(1 To 5) As Variant
For k = 1 To 5
s(k) = 0
For i = 1 To 3
s(k) = s(k) + MSFlexGrid1.TextMatrix(k, i)
Next i
MSFlexGrid1.TextMatrix(k, 4) = s(k) / 3
Next k
End Sub
Private Sub Command2_Click()
Form7.Hide: Form6.Show
End Sub
Private Sub Command3_Click()
Form7.Hide: Form8.Show
End Sub
Private Sub Form_Load()
MSFlexGrid1.TextMatrix(0, 1) = "Матем."
MSFlexGrid1.TextMatrix(0, 2) = "Физика"
MSFlexGrid1.TextMatrix(0, 3) = "Информ."
MSFlexGrid1.TextMatrix(0, 4) = "Ср.оценка"
End Sub
Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 0 To 255
MSFlexGrid1.Text = MSFlexGrid1.Text & Chr(KeyAscii)
End Select
End Sub
Задача № 8
До сортировки:
После сортировки:
Dim a(6, 5) As Variant
Dim x As Variant
Private Sub Command1_Click()
Dim s(1 To 5) As Variant
Dim tmp As Variant
For k = 1 To 5
s(k) = 0
For i = 1 To 3
s(k) = s(k) + MSFlexGrid1.TextMatrix(k, i)
Next i
MSFlexGrid1.TextMatrix(k, 4) = s(k) / 3
Next k
End Sub
Private Sub Command2_Click()
Form8.Hide: Form7.Show
End Sub
Private Sub Command3_Click()
Form8.Hide: Form9.Show
End Sub
Private Sub Command4_Click()
x = 4
For j = 1 To MSFlexGrid1.Rows - 1
For i = j To MSFlexGrid1.Rows - 1
If MSFlexGrid1.TextMatrix(j, x) > MSFlexGrid1.TextMatrix(i, x) Then
For k = 0 To MSFlexGrid1.Cols - 1
tmp = MSFlexGrid1.TextMatrix(j, k)
MSFlexGrid1.TextMatrix(j, k) = MSFlexGrid1.TextMatrix(i, k)
MSFlexGrid1.TextMatrix(i, k) = tmp
Next k
End If
Next i
Next j
End Sub
Private Sub Form_Load()
MSFlexGrid1.TextMatrix(0, 1) = "Матем."
MSFlexGrid1.TextMatrix(0, 2) = "Физика"
MSFlexGrid1.TextMatrix(0, 3) = "Информ."
MSFlexGrid1.TextMatrix(0, 4) = "Ср.оценка"
End Sub
Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 0 To 255
MSFlexGrid1.Text = MSFlexGrid1.Text & Chr(KeyAscii)
End Select
End Sub
Private Sub MSFlexGrid2_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 0 To 255
MSFlexGrid2.Text = MSFlexGrid1.Text & Chr(KeyAscii)
End Select
End Sub
Задача № 9
(Функция)
Private Sub Command1_Click()
Dim a(6, 5) As Variant
Dim s(1 To 5) As Variant
Dim tmp As Variant
For k = 1 To 5
s(k) = 0
For i = 1 To 3
s(k) = s(k) + MSFlexGrid1.TextMatrix(k, i)
Next i
MSFlexGrid1.TextMatrix(k, 4) = s(k) / 3
Next k
End Sub
Private Sub Command2_Click()
Form9.Hide: Form8.Show
End Sub
Private Sub Command3_Click()
Form9.Hide: Form11.Show
End Sub
Public Sub Command4_Click()
w = Sort(MSFlexGrid1, 4)
End Sub
Private Sub Form_Load()
MSFlexGrid1.TextMatrix(0, 1) = "Матем."
MSFlexGrid1.TextMatrix(0, 2) = "Физика"
MSFlexGrid1.TextMatrix(0, 3) = "Информ."
MSFlexGrid1.TextMatrix(0, 4) = "Ср.оценка"
End Sub
Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 0 To 255
MSFlexGrid1.Text = MSFlexGrid1.Text & Chr(KeyAscii)
End Select
End Sub
(Процедура)
Private Sub Command1_Click()
Dim a(6, 5) As Variant
Dim s(1 To 5) As Variant
Dim tmp As Variant
For k = 1 To 5
s(k) = 0
For i = 1 To 3
s(k) = s(k) + MSFlexGrid1.TextMatrix(k, i)
Next i
MSFlexGrid1.TextMatrix(k, 4) = s(k) / 3
Next k
End Sub
Private Sub Command2_Click()
Form11.Hide: Form9.Show
End Sub
Private Sub Command3_Click()
Form11.Hide: Form10.Show
End Sub
Public Sub Command4_Click()
Sortirovka MSFlexGrid1, 4
End Sub
Private Sub Form_Load()
MSFlexGrid1.TextMatrix(0, 1) = "Матем."
MSFlexGrid1.TextMatrix(0, 2) = "Физика"
MSFlexGrid1.TextMatrix(0, 3) = "Информ."
MSFlexGrid1.TextMatrix(0, 4) = "Ср.оценка"
End Sub
Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 0 To 255
MSFlexGrid1.Text = MSFlexGrid1.Text & Chr(KeyAscii)
End Select
End Sub
Модуль1.
Public Function Sort(w As Object, x As Long) As Long
For j = 1 To w.Rows - 1
For i = j To w.Rows - 1
If CInt(w.TextMatrix(j, x)) > CInt(w.TextMatrix(i, x)) Then
For k = 0 To w.Cols - 1
tmp = w.TextMatrix(j, k)
w.TextMatrix(j, k) = w.TextMatrix(i, k)
w.TextMatrix(i, k) = tmp
Next k
End If
Next i
Next j
Exit Function
End Function
Public Sub Sortirovka(w As Object, x As Long)
For j = 1 To w.Rows - 1
For i = j To w.Rows - 1
If CInt(w.TextMatrix(j, x)) > CInt(w.TextMatrix(i, x)) Then
For k = 0 To w.Cols - 1
tmp = w.TextMatrix(j, k)
w.TextMatrix(j, k) = w.TextMatrix(i, k)
w.TextMatrix(i, k) = tmp
Next k
End If
Next i
Next j
Exit Sub
End Sub
Задача № 10
Dim n As Integer
Private Sub Command1_Click()
Text1.Text = " 000 " & vbCrLf & " 0 0 " & vbCrLf & "0 0" & vbCrLf & "0 0" & vbCrLf & "0 0" & vbCrLf & "0 0" & vbCrLf & "0 0" & vbCrLf & " 0 0 " & vbCrLf & " 000 "
End Sub
Private Sub Command10_Click()
Text1.Text = " 000 " & vbCrLf & "0 0" & vbCrLf & "0 0" & vbCrLf & "0 0 " & vbCrLf & " 000 " & vbCrLf & " 0" & vbCrLf & " 0" & vbCrLf & "0 0" & vbCrLf & "0 0 " & vbCrLf & " 000 "
End Sub
Private Sub Command11_Click()
Dim Name As String
Dim k As String
k = Text1.Text
n = FreeFile
CommonDialog1.ShowSave
Name = CommonDialog1.FileName
If Name = "" Then MsgBox "íå ââåäåíî çíà÷åíèå"
If Name <> "" Then
Open Name For Output As n
Do Until EOF(n)
Line Input #n, k
Loop
Close
End If
CommonDialog1.FileName = ""
End Sub
Private Sub Command13_Click()
Form10.Hide: Form11.Show
End Sub
Private Sub Command2_Click()
Text1.Text = " 0 " & vbCrLf & " 00 " & vbCrLf & " 0 0 " & vbCrLf & "0 0 " & vbCrLf & " 0 " & vbCrLf & " 0 " & vbCrLf & " 0 " & vbCrLf & " 0 " & vbCrLf & " 0000 "
End Sub
Private Sub Command4_Click()
Text1.Text = " 000 " & vbCrLf & "0 0" & vbCrLf & "0 0" & vbCrLf & " 0 " & vbCrLf & " 00 " & vbCrLf & " 0 " & vbCrLf & " 0" & vbCrLf & "0 0" & vbCrLf & "0 0" & vbCrLf & "0 0 " & vbCrLf & " 000 "
End Sub
Private Sub Command3_Click()
Text1.Text = " 000 " & vbCrLf & "0 0" & vbCrLf & "0 0" & vbCrLf & " 0 " & vbCrLf & " 0 " & vbCrLf & " 0 " & vbCrLf & " 0 " & vbCrLf & "0 " & vbCrLf & "00000"
End Sub
Private Sub Command5_Click()
Text1.Text = " 0 " & vbCrLf & " 00 " & vbCrLf & " 0 0 " & vbCrLf & "0 0 " & vbCrLf & "00000" & vbCrLf & " 0 " & vbCrLf & " 0 " & vbCrLf & " 0 "
End Sub
Private Sub Command6_Click()
Text1.Text = "00000" & vbCrLf & "0 " & vbCrLf & "0 00 " & vbCrLf & "00 0 " & vbCrLf & "0 0" & vbCrLf & " 0" & vbCrLf & " 0" & vbCrLf & "0 0" & vbCrLf & "0 0 " & vbCrLf & " 000 "
End Sub
Private Sub Command7_Click()
Text1.Text = " 0000 " & vbCrLf & "0 0" & vbCrLf & "0 " & vbCrLf & "0000 " & vbCrLf & "0 0" & vbCrLf & "0 0" & vbCrLf & "0 0" & vbCrLf & "0 0" & vbCrLf & "0 0 " & vbCrLf & " 000 "
End Sub
Private Sub Command8_Click()
Text1.Text = "0000000" & vbCrLf & " 0" & vbCrLf & " 0 " & vbCrLf & " 0 " & vbCrLf & " 0 " & vbCrLf & " 0 " & vbCrLf & " 0 " & vbCrLf & " 0 "
End Sub
Private Sub Command9_Click()
Text1.Text = " 000 " & vbCrLf & "0 0" & vbCrLf & "0 0" & vbCrLf & "0 0 " & vbCrLf & " 00 " & vbCrLf & "0 0 " & vbCrLf & "0 0" & vbCrLf & "0 0" & vbCrLf & "0 0" & vbCrLf & "0 0 " & vbCrLf & " 000 "
End Sub
Альбом лабораторных
работ по информатике и программированию