-
Notifications
You must be signed in to change notification settings - Fork 0
/
verification_cb.cpp
62 lines (44 loc) · 920 Bytes
/
verification_cb.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
/**********************************************
Description: verification cle cb
by: BUNELIER Hugo | github bubudotsh
Created: 2022-09-30 18:45:43
Updated: 2022-09-30 18:58:56
************************************************/
#include <iostream>
#include <string>
using namespace std;
int main() {
string buff;
string res;
int p = 0;
int i = 0;
int pc;
cout << "code cb" << endl;
cin >> buff;
pc = buff[15] - '0';
while (i != 10) {
if (((buff[i] - '0') * 2) > 9) {
buff[i] = ((buff[i] - '0') * 2) - 9;
// res[i] = buff[i] + '0';
} else {
buff[i] = ((buff[i] - '0') * 2);
}
i++;
i++;
}
cout << res[0] << endl;
for (int y = 0; y != 14; y++) {
p = p + buff[y];
}
p = p % 10;
if (p != 0) {
p = 10 - p;
}
if (pc == p) {
cout << "carte valide" << endl;
} else {
cout << "carte non valide" << endl;
}
cin.get(); cin.ignore();
return EXIT_SUCCESS;
}