Мой Kbyte.Ru
Рассылка Kbyte.Ru
Группы на Kbyte.Ru
Партнеры Kbyte.Ru
Реклама
Сделано руками
Сделано руками
> Исходные коды - Жак Кусто -

Visual Basic 5.0/6.0 - Числа, математика, финансы

Все примеры / Числа, математика, финансы

Перестановка чисел

Автор: Жак Кусто | добавлено: 06.03.2010, 11:34 | просмотров: 1578 (2+) | комментариев: 0 | рейтинг: *x1
Мой друг, Фанат одной Рад.cтан.Там раз.300 000 рублей.Надо было дост. до Аськи первым, зная все числа,но не зная порядка,каждый час говорили по цифре и шансы росли.Вот и попросил он меня написать прогу. Конечно же мы ничего не выиграли, и 30% я не получил : ) Но родилась прога! С ужасно смешным кодом, аж плакать хочется. Кто знает, как сделать легче и быстрее.

Код

Option Explicit
Dim A As Integer
Dim B As Integer
Dim C As Integer
Dim E As Integer
Dim D As Integer
Dim F As Integer
Dim G As Integer
Dim H As Integer
Dim L As Integer
Dim Z As Integer
Dim K As Integer
Dim i As Integer
Dim j As Integer
Dim Dob As String
Dim s As Long
Dim ss As Long
Dim Polnoe As Long
Dim Skolko As Integer
Dim p(1 To 11) As Integer
Dim prop(1 To 11) As Integer
Dim propusk As Integer
Dim Yhi(0 To 11) As Long
Dim Ygadhi(0 To 11) As Long
Dim AllText As String 'Îáúÿâëÿåì òåêñòîâóþ ïåðåìåííóþ AllText - âåñü òåêñò
Dim prov1(1 To 100000) As Long
Dim prov2(1 To 100000) As Long
Dim W As Integer
Private Sub Command1_Click()
Label2.Caption = ""
If Text3.Text = "" Then Dob = "": GoTo 123
Dob = Text3.Text


123
If Text1.Text = "" Then Text2.Text = "Íó ÷òî-òî äîëæíî æå áûòü?!": Text1.Text = "?": Label2.Caption = "Ïîâíèìàòåëüíåé": GoTo 111
On Error GoTo 112
s = 0
Text2.Text = ""
Polnoe = Text1.Text
Skolko = Len(Str(Polnoe))

For i = 1 To Skolko - 1
Ygadhi(i) = Mid(Polnoe, i, 1)

Next i
Skolko = Skolko - 1
If Skolko = 10 Then
Open "C:\Âñåãî10.txt" For Append As #1
  For A = 0 To 9
    Yhi(A) = A
  For B = 0 To 9
    Yhi(B) = B
  For C = 0 To 9
    Yhi(C) = C
  For D = 0 To 9
    Yhi(D) = D
  For E = 0 To 9
    Yhi(E) = E
  For F = 0 To 9
    Yhi(F) = F
 For G = 0 To 9
    Yhi(G) = G
  For H = 0 To 9
    Yhi(H) = H
  For L = 0 To 9
    Yhi(L) = L
  For Z = 0 To 9
    Yhi(Z) = Z
           For i = 1 To 10
              p(i) = 0
               prop(i) = 0
           Next i
            For i = 1 To 10
            If i = 1 Then K = A
            If i = 2 Then K = B
            If i = 3 Then K = C
            If i = 4 Then K = D
            If i = 5 Then K = E
            If i = 6 Then K = F
            If i = 7 Then K = G
            If i = 8 Then K = H
            If i = 9 Then K = L
            If i = 0 Then K = Z
             For j = 1 To 10
               If p(j) = 1 Then GoTo 1
               If Yhi(K) = Ygadhi(j) Then prop(i) = 1: p(j) = 1:  GoTo 2:
1
             Next j
2
           Next i
  propusk = 0
 For i = 1 To 10
 propusk = propusk + prop(i)
 Next i
 If propusk = 10 Then s = s + 1:  Print #1, Dob & Yhi(A) & Yhi(B) & Yhi(C) & Yhi(D) & Yhi(E) & Yhi(F) & Yhi(G) & Yhi(H) & Yhi(L) & Yhi(Z):: Text2.Text = Text2.Text + "¹" & s & "   " & Str(Dob & Yhi(A) & Yhi(B) & Yhi(C) & Yhi(D) & Yhi(E) & Yhi(F) & Yhi(G) & Yhi(H) & Yhi(L) & Yhi(Z)) + Chr(13) + Chr(10) ': Stop
Label1.Caption = "Âñåãî " & s & " ïåðåñòàíîâîê"
Next Z
Next L
Next H
Next G
Next F
Next E
Next D
Next C
Next B
Next A
Close #1
End If

If Skolko = 9 Then
Open "C:\Âñåãî9.txt" For Append As #1
  For A = 0 To 9
    Yhi(A) = A
  For B = 0 To 9
    Yhi(B) = B
  For C = 0 To 9
    Yhi(C) = C
  For D = 0 To 9
    Yhi(D) = D
  For E = 0 To 9
    Yhi(E) = E
  For F = 0 To 9
    Yhi(F) = F
 For G = 0 To 9
    Yhi(G) = G
  For H = 0 To 9
    Yhi(H) = H
  For L = 0 To 9
    Yhi(L) = L

           For i = 1 To 9
              p(i) = 0
               prop(i) = 0
           Next i
            For i = 1 To 9
            If i = 1 Then K = A
            If i = 2 Then K = B
            If i = 3 Then K = C
            If i = 4 Then K = D
            If i = 5 Then K = E
            If i = 6 Then K = F
            If i = 7 Then K = G
            If i = 8 Then K = H
            If i = 9 Then K = L
 
             For j = 1 To 9
               If p(j) = 1 Then GoTo 12
               If Yhi(K) = Ygadhi(j) Then prop(i) = 1: p(j) = 1:  GoTo 22:
12
             Next j
22
           Next i
  propusk = 0
 For i = 1 To 9
 propusk = propusk + prop(i)
 Next i
 If propusk = 9 Then s = s + 1: Print #1, Dob & Yhi(A) & Yhi(B) & Yhi(C) & Yhi(D) & Yhi(E) & Yhi(F) & Yhi(G) & Yhi(H) & Yhi(L): Text2.Text = Text2.Text + "¹" & s & "   " & Str(Dob & Yhi(A) & Yhi(B) & Yhi(C) & Yhi(D) & Yhi(E) & Yhi(F) & Yhi(G) & Yhi(H) & Yhi(L)) + Chr(13) + Chr(10)  ': Stop
Label1.Caption = "Âñåãî " & s & " ïåðåñòàíîâîê"

Next L
Next H
Next G
Next F
Next E
Next D
Next C
Next B
Next A
Close #1
End If
If Skolko = 8 Then
Open "C:\Âñåãî8.txt" For Append As #1
  For A = 0 To 9
    Yhi(A) = A
  For B = 0 To 9
    Yhi(B) = B
  For C = 0 To 9
    Yhi(C) = C
  For D = 0 To 9
    Yhi(D) = D
  For E = 0 To 9
    Yhi(E) = E
  For F = 0 To 9
    Yhi(F) = F
 For G = 0 To 9
    Yhi(G) = G
  For H = 0 To 9
    Yhi(H) = H

           For i = 1 To 8
              p(i) = 0
               prop(i) = 0
           Next i
            For i = 1 To 8
            If i = 1 Then K = A
            If i = 2 Then K = B
            If i = 3 Then K = C
            If i = 4 Then K = D
            If i = 5 Then K = E
            If i = 6 Then K = F
            If i = 7 Then K = G
            If i = 8 Then K = H
         
             For j = 1 To 8
               If p(j) = 1 Then GoTo 13
               If Yhi(K) = Ygadhi(j) Then prop(i) = 1: p(j) = 1:  GoTo 23:
13
             Next j
23
           Next i
  propusk = 0
 For i = 1 To 8
 propusk = propusk + prop(i)
 Next i
 If propusk = 8 Then s = s + 1: Print #1, Dob & Yhi(A) & Yhi(B) & Yhi(C) & Yhi(D) & Yhi(E) & Yhi(F) & Yhi(G) & Yhi(H):    Text2.Text = Text2.Text + "¹" & s & "   " & Str(Dob & Yhi(A) & Yhi(B) & Yhi(C) & Yhi(D) & Yhi(E) & Yhi(F) & Yhi(G) & Yhi(H)) + Chr(13) + Chr(10) ': Stop
Label1.Caption = "Âñåãî " & s & " ïåðåñòàíîâîê"

Next H
Next G
Next F
Next E
Next D
Next C
Next B
Next A
Close #1
End If
If Skolko = 7 Then
Open "C:\Âñåãî7.txt" For Append As #1
  For A = 0 To 9
    Yhi(A) = A
  For B = 0 To 9
    Yhi(B) = B
  For C = 0 To 9
    Yhi(C) = C
  For D = 0 To 9
    Yhi(D) = D
  For E = 0 To 9
    Yhi(E) = E
  For F = 0 To 9
    Yhi(F) = F
 For G = 0 To 9
    Yhi(G) = G


           For i = 1 To 7
              p(i) = 0
               prop(i) = 0
           Next i
            For i = 1 To 7
            If i = 1 Then K = A
            If i = 2 Then K = B
            If i = 3 Then K = C
            If i = 4 Then K = D
            If i = 5 Then K = E
            If i = 6 Then K = F
            If i = 7 Then K = G
         
         
             For j = 1 To 7
               If p(j) = 1 Then GoTo 14
               If Yhi(K) = Ygadhi(j) Then prop(i) = 1: p(j) = 1:  GoTo 24:
14
             Next j
24
           Next i
  propusk = 0
 For i = 1 To 7
 propusk = propusk + prop(i)
 Next i
 If propusk = 7 Then s = s + 1: Print #1, Dob & Yhi(A) & Yhi(B) & Yhi(C) & Yhi(D) & Yhi(E) & Yhi(F) & Yhi(G):  Text2.Text = Text2.Text + "¹" & s & "   " & Str(Dob & Yhi(A) & Yhi(B) & Yhi(C) & Yhi(D) & Yhi(E) & Yhi(F) & Yhi(G)) + Chr(13) + Chr(10) ': Stop
Label1.Caption = "Âñåãî " & s & " ïåðåñòàíîâîê"


Next G
Next F
Next E
Next D
Next C
Next B
Next A
Close #1
End If
If Skolko = 6 Then
Open "C:\Âñåãî6.txt" For Append As #1
  For A = 0 To 9
    Yhi(A) = A
  For B = 0 To 9
    Yhi(B) = B
  For C = 0 To 9
    Yhi(C) = C
  For D = 0 To 9
    Yhi(D) = D
  For E = 0 To 9
    Yhi(E) = E
  For F = 0 To 9
    Yhi(F) = F



           For i = 1 To 6
              p(i) = 0
               prop(i) = 0
           Next i
            For i = 1 To 6
            If i = 1 Then K = A
            If i = 2 Then K = B
            If i = 3 Then K = C
            If i = 4 Then K = D
            If i = 5 Then K = E
            If i = 6 Then K = F
          
         
         
             For j = 1 To 6
               If p(j) = 1 Then GoTo 15
               If Yhi(K) = Ygadhi(j) Then prop(i) = 1: p(j) = 1:  GoTo 25:
15
             Next j
25
           Next i
  propusk = 0
 For i = 1 To 6
 propusk = propusk + prop(i)
 Next i
 If propusk = 6 Then s = s + 1: Print #1, Dob & Yhi(A) & Yhi(B) & Yhi(C) & Yhi(D) & Yhi(E) & Yhi(F):  Text2.Text = Text2.Text + "¹" & s & "   " & Str(Dob & Yhi(A) & Yhi(B) & Yhi(C) & Yhi(D) & Yhi(E) & Yhi(F)) + Chr(13) + Chr(10) ': Stop
Label1.Caption = "Âñåãî " & s & " ïåðåñòàíîâîê"



Next F
Next E
Next D
Next C
Next B
Next A
Close #1
End If
If Skolko = 5 Then
Open "C:\Âñåãî5.txt" For Append As #1
  For A = 0 To 9
    Yhi(A) = A
  For B = 0 To 9
    Yhi(B) = B
  For C = 0 To 9
    Yhi(C) = C
  For D = 0 To 9
    Yhi(D) = D
  For E = 0 To 9
    Yhi(E) = E




           For i = 1 To 5
              p(i) = 0
               prop(i) = 0
           Next i
            For i = 1 To 5
            If i = 1 Then K = A
            If i = 2 Then K = B
            If i = 3 Then K = C
            If i = 4 Then K = D
            If i = 5 Then K = E
          
          
         
         
             For j = 1 To 5
               If p(j) = 1 Then GoTo 16
               If Yhi(K) = Ygadhi(j) Then prop(i) = 1: p(j) = 1:  GoTo 26:
16
             Next j
26
           Next i
  propusk = 0
 For i = 1 To 5
 propusk = propusk + prop(i)
 Next i
 If propusk = 5 Then s = s + 1: Print #1, Dob & Yhi(A) & Yhi(B) & Yhi(C) & Yhi(D) & Yhi(E):  Text2.Text = Text2.Text + "¹" & s & "   " & Str(Dob & Yhi(A) & Yhi(B) & Yhi(C) & Yhi(D) & Yhi(E)) + Chr(13) + Chr(10) ': Stop
Label1.Caption = "Âñåãî " & s & " ïåðåñòàíîâîê"




Next E
Next D
Next C
Next B
Next A
Close #1
End If
If Skolko = 4 Then
Open "C:\Âñåãî4.txt" For Append As #1
  For A = 0 To 9
    Yhi(A) = A
  For B = 0 To 9
    Yhi(B) = B
  For C = 0 To 9
    Yhi(C) = C
  For D = 0 To 9
    Yhi(D) = D





           For i = 1 To 4
              p(i) = 0
               prop(i) = 0
           Next i
            For i = 1 To 4
            If i = 1 Then K = A
            If i = 2 Then K = B
            If i = 3 Then K = C
            If i = 4 Then K = D
          
          
          
         
         
             For j = 1 To 4
               If p(j) = 1 Then GoTo 17
               If Yhi(K) = Ygadhi(j) Then prop(i) = 1: p(j) = 1:  GoTo 27:
17
             Next j
27
           Next i
  propusk = 0
 For i = 1 To 4
 propusk = propusk + prop(i)
 Next i
 If propusk = 4 Then s = s + 1: Print #1, Dob & Yhi(A) & Yhi(B) & Yhi(C) & Yhi(D): Text2.Text = Text2.Text + "¹" & s & "   " & Str(Dob & Yhi(A) & Yhi(B) & Yhi(C) & Yhi(D)) + Chr(13) + Chr(10)  ': Stop
Label1.Caption = "Âñåãî " & s & " ïåðåñòàíîâîê"




Next D
Next C
Next B
Next A
Close #1
End If
If Skolko = 3 Then
Open "C:\Âñåãî3.txt" For Append As #1
  For A = 0 To 9
    Yhi(A) = A
  For B = 0 To 9
    Yhi(B) = B
  For C = 0 To 9
    Yhi(C) = C






           For i = 1 To 3
              p(i) = 0
               prop(i) = 0
           Next i
            For i = 1 To 3
            If i = 1 Then K = A
            If i = 2 Then K = B
            If i = 3 Then K = C
          
          
          
          
         
         
             For j = 1 To 3
               If p(j) = 1 Then GoTo 18
               If Yhi(K) = Ygadhi(j) Then prop(i) = 1: p(j) = 1:  GoTo 28:
18
             Next j
28
           Next i
  propusk = 0
 For i = 1 To 3
 propusk = propusk + prop(i)
 Next i
 If propusk = 3 Then s = s + 1: Print #1, Dob & Yhi(A) & Yhi(B) & Yhi(C): Text2.Text = Text2.Text + "¹" & s & "   " & Str(Dob & Yhi(A) & Yhi(B) & Yhi(C)) + Chr(13) + Chr(10)  ': Stop
Label1.Caption = "Âñåãî " & s & " ïåðåñòàíîâîê"





Next C
Next B
Next A
Close #1
End If
If Skolko = 2 Then
Open "C:\Âñåãî2.txt" For Append As #1
  For A = 0 To 9
    Yhi(A) = A
  For B = 0 To 9
    Yhi(B) = B







           For i = 1 To 2
              p(i) = 0
              prop(i) = 0
           Next i
            For i = 1 To 2
            If i = 1 Then K = A
            If i = 2 Then K = B
         
          
          
          
          
         
         
             For j = 1 To 2
               If p(j) = 1 Then GoTo 19
               If Yhi(K) = Ygadhi(j) Then prop(i) = 1: p(j) = 1:  GoTo 29:
19
             Next j
29
           Next i
  propusk = 0
 For i = 1 To 2
 propusk = propusk + prop(i)
 Next i
 If propusk = 2 Then s = s + 1: Print #1, Dob & Yhi(A) & Yhi(B):  Text2.Text = Text2.Text + "¹" & s & "   " & Str(Dob & Yhi(A) & Yhi(B)) + Chr(13) + Chr(10)  ': Stop
 Label1.Caption = "Âñåãî " & s & " ïåðåñòàíîâîê"
Next B
Next A
Close #1
End If
If Skolko = 1 Then
Open "C:\Âñåãî1.txt" For Append As #1
  For A = 0 To 9
    Yhi(A) = A








           For i = 1 To 1
              p(i) = 0
               prop(i) = 0
           Next i
            For i = 1 To 1
            If i = 1 Then K = A
            
         
          
          
          
          
         
         
             For j = 1 To 1
               If p(j) = 1 Then GoTo 100
               If Yhi(K) = Ygadhi(j) Then prop(i) = 1: p(j) = 1:  GoTo 10:
100
             Next j
10
           Next i
  propusk = 0
 For i = 1 To 1
 propusk = propusk + prop(i)
 Next i
 If propusk = 1 Then s = s + 1: Print #1, Dob & Yhi(A): Text2.Text = Text2.Text + "¹" & s & "   " & Str(Dob & Yhi(A)) + Chr(13) + Chr(10)  ': Stop
Label1.Caption = "Âñåãî " & s & " ïåðåñòàíîâîê"







Next A
Close #1
End If
Label2.Caption = "Процесс Завершен.": GoTo 113
112 Text2.Text = "С буквами не умею :("
111
113
End Sub
Файлы leksikografiia_s_dobavkoi.rar (8,22 Кб)
Обратите внимание
Язык Visual Basic 6.0 является устаревшим. Многие примеры, размещенные на нашем сайте, были созданы еще во времена Windows 98 и могут не работать в современных операционных системах.
Если у вас возникнут какие-либо проблемы или вопросы, вы можете обратиться за помощью на наш форум.
Об авторе

Жак Кусто

Нет информации об авторе...

См. также:
Профиль автора
Жак Кусто
Другие примеры этого автора (всего: 3)
Последние комментарии (всего: 0)

Добавлять комментарии могут только зарегистрированные пользователи сайта.
Если у Вас уже есть учетная запись на Kbyte.Ru, пройдите процедуру авторизации OpenID.
Если Вы еще не зарегистрированы на Kbyte.Ru - зарегистрируйтесь.


Нет комментариев...

Авторизация
 
OpenID
Зарегистрируйся и получи 10% скидку на добавление своего сайта в каталоги! Подробнее »
Поиск по сайту
Реклама
Счетчики