-
Notifications
You must be signed in to change notification settings - Fork 0
/
FMIVault.cpp
116 lines (114 loc) · 3.58 KB
/
FMIVault.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// FMIVault.cpp
// Daniel Shterev
#include <iostream>
using namespace std ;
int main()
{
unsigned int a, b, c, d, e, f, g, h, i, j = 0 ;
cin >> a ;
b = a / 100000000 ; // card version
c = ( a / 1000000 ) % 10 ; // owner spec
d = ( a % 1000000 ) / 10 ; // owner_id
e = d / 10000 ; // first element of owner id
f = ( d / 1000 ) % 10 ; // second element of owner id
g = ( d / 100 ) % 10 ; // third element of owner id
h = ( d / 10 ) % 10 ; // foruth element of owner id
i = d % 10 ; // fifth element of owner id
if ( e == 0 && e == f ) //checks if first element is 0 and if it is equal to second element
{
j++;
}
if ( e == 0 && e == g ) //checks if first element is 0 and if it is equal to third element
{
j++;
}
if ( e == 0 && e == h ) //checks if first element is 0 and if it is equal to fourth element
{
j++;
}
if ( e == 0 && e == i ) //checks if first element is 0 and if it is equal to fifth element
{
j++;
}
if ( f == 0 && f == g ) //checks if second element is 0 and if it is equal to third element
{
j++;
}
if ( f == 0 && f == h ) //checks if second element is 0 and if it is equal to fourth element
{
j++;
}
if ( f == 0 && f == i ) //checks if third element is 0 and if it is equal to fifth element
{
j++;
}
if ( g == 0 && g == h ) //checks if third element is 0 and if it is equal to fourth element
{
j++;
}
if ( g == 0 && g == i ) //checks if third element is 0 and if it is equal to fifth element
{
j++;
}
if ( h == 0 && h == i ) //checks if fourth element is 0 and if it is equal to fifth element
{
j++;
}
if ( j >= 1 ) // checks if there is more than 1 element that is equal to 0
{
cout << "Invalid card number" << endl ;
return 0 ;
}
else
{
cout << "{ “card_version”: " << b ;
switch ( c ) // checks every option for owner_spec
{
case 0:
{
cout << ", “owner_spec”: “Informatics”, “owner_id”: " << d << " }" << endl ;
return 0;
}
case 1:
{
cout << ", “owner_spec”: “Computer science”, “owner_id”: " << d << " }" ;
cout << endl ;
return 0;
}
case 2:
{
cout << ", “owner_spec”: “Informational systems”, “owner_id”: " << d << " }" ;
cout << endl ;
return 0;
}
case 3:
{
cout << ", “owner_spec”: “Software engineering”, “owner_id”: " << d << " }" ;
cout << endl ;
return 0;
}
case 4:
{
cout << ", “owner_spec”: “Applied mathematics”, “owner_id”: " << d << " }" ;
cout << endl ;
return 0;
}
case 5:
{
cout << ", “owner_spec”: “Mathematics”, “owner_id”: " << d << " }" << endl ;
return 0;
}
case 6:
{
cout << ", “owner_spec”: “Statistics”, “owner_id”: " << d << " }" << endl ;
return 0;
}
case 8:
{
cout << ", “owner_spec”: “Mathematics and Informatics”, “owner_id”: " ;
cout << d << " }" << endl ;
return 0;
}
}
}
}