-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathregular-plates.cpp
32 lines (27 loc) · 981 Bytes
/
regular-plates.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
#include <iostream>
#include <fstream>
#include <iomanip>
#include <array>
int main() {
std::ofstream regularPlatesFile("regular-plates.txt");
if (!regularPlatesFile) {
std::cerr << "Error opening file!" << std::endl;
return 1;
}
const std::array<char, 7> plateChars = {'A', 'E', 'O', 'J', 'K', 'M', 'T'};
for (const auto& firstChar : plateChars) {
for (int num1 = 0; num1 < 100; ++num1) {
for (const auto& secondChar : plateChars) {
for (int num2 = 0; num2 < 1000; ++num2) {
regularPlatesFile << firstChar
<< std::setw(2) << std::setfill('0') << num1
<< '-' << secondChar << '-'
<< std::setw(3) << std::setfill('0') << num2
<< '\n';
}
}
}
}
regularPlatesFile.close();
return 0;
}