Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PlateToInt(Chars[], Numbers) {
- new parts;
- for (new x = 0; x < 3; x++) Chars[x] -= 'A';
- parts = (Chars[0] * 26 * 26) + (Chars[1] * 26) + Chars[2];
- Numbers <<= 15;
- parts |= Numbers;
- return parts;
- }
- IntToPlate(In, chars[], size = sizeof chars) {
- if(size < 7) return;
- new parts[2];
- parts[1] = In >> 15;
- parts[0] = In & 32767;
- chars[2] = parts[0] % 26 + 'A'; parts[0] /= 26;
- chars[1] = parts[0] % 26 + 'A'; parts[0] /= 26;
- chars[0] = parts[0] % 26 + 'A';
- new numbers[4];
- numbers[0] = parts[1] / 100 + '0';
- numbers[1] = (parts[1] % 100) / 10 + '0';
- numbers[2] = parts[1] % 10 + '0';
- strcat(chars, numbers, size);
- }
- main() {
- new chr[3] = { 'Z', 'Z', 'Z' };
- new num = 999;
- new lel = PlateToInt(chr, num);
- printf("%i", lel);
- new lol[7];
- IntToPlate(lel, lol);
- print(lol);
- }
Advertisement
Add Comment
Please, Sign In to add comment