Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstring>
- #include <cstdlib>
- struct Car
- {
- char nn[10];
- // Добавить необходимые поля структуры
- };
- class DB
- {
- struct Car *data_ptr = nullptr;
- int size=0, capacity=0;
- public:
- DB()
- {
- data_ptr = new Car[5];
- capacity = 5;
- }
- // Реализовать методы добавления машинки в массив и поиска.
- };
- struct Command
- {
- int time = 0;
- char car_nn[10];
- char type = '!';
- };
- // 02:31 * hdsgjf
- // 0:0 =
- Command parser(char *str)
- {
- Command test;
- long h, m;
- h = strtol(str, &str, 10);
- if (*str != ':') return test;
- m = strtol(str + 1, &str, 10);
- // Проверка на корректность времени
- ++str;
- if (*str == '=' && h == 0 && m == 0)
- {
- test.type = '=';
- return test;
- }
- if (*str == '*' && *(str + 1) == ' ')
- {
- test.time = h * 60 + m;
- test.type = '*';
- strcpy_s(test.car_nn, str + 2);
- }
- return test;
- }
- void main()
- {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement