1 #include <iostream>
2 #include <string>
3 #include <stdlib.h>
4 #include <time.h>
5
6 using namespace std;
7
8 int main()
9 {
10 int a, x1, x2, s;
11 string str1[2] = {"A1910", "A1423"};
12
13 srand((unsigned)time(NULL));
14
15 a = rand() % 10;
16 x1 = rand() % 10;
17 s = rand() % 2;
18
19 for(int i = 0; i < 10; i++)
20 {
21 if((x1 + i) % 10 == 4)
22 {
23 x2 = i;
24 break;
25 }
26 }
27
28 cout << str1[s] << a << a << x1 << x2 << a << endl;
29
30 return 0;
31 }
1 Private Function GetKey() As String
2 Dim str1(2) As String
3 Dim a As Integer, x1 As Integer, x2 As Integer, s As Integer
4 str1(1) = "A1910"
5 str1(2) = "A1423"
6
7 Randomize
8 a = Int(Rnd * 10)
9 x1 = Int(Rnd * 10)
10 s = Int(Rnd * 2) + 1
11
12 For i = 0 To 9
13 If (x1 + i) Mod 10 = 4 Then
14 x2 = i
15 Exit For
16 End If
17 Next i
18
19 GetKey = str1(s) & a & a & x1 & x2 & a
20 End Function