/
Cheburek
/
Lab_work_five
Обзор
Документация
Войти
/
Cheburek
/
Lab_work_five
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
main.cpp
82 строки
2 KB
Cheburek
main.cpp
24 мар 2026, 14:48
Верифицирован
24 мар 2026, 14:48
ca655be
Код
Авторство
О чём код?
#include <iostream> #include <string> #include <windows.h> #include "Tree.h" #include "FileOps.h" #include "Tests.h" using namespace std; int main() { system("chcp 1251 > nul"); SetConsoleCP(1251); SetConsoleOutputCP(1251); setlocale(LC_ALL, "Russian"); Tree tree; int cmd; do { cout << "\n===== ���� =====\n"; cout << "1 - �������� ������� � �������\n"; cout << "2 - ����� �� ���������� ������\n"; cout << "3 - ������� �� ���������� ������\n"; cout << "4 - ��������� �� �����\n"; cout << "5 - �������� �� ������\n"; cout << "9 - ��������� ���������\n"; cout << "0 - �����\n"; cout << "> "; cin >> cmd; if (cmd == 1) { Data d; cout << "�������: ��������� �����, �������, ����, �����, �������������\n"; cout << "> "; cin >> d.id >> d.fullName >> d.experience >> d.salary >> d.speciality; tree.insert(d); cout << "���������!\n"; } else if (cmd == 2) { int key; cout << "������� ��������� �����: "; cin >> key; TreeNode* found = tree.search(key); if (found) { cout << "������ ���������:\n"; tree.printData(found->data); } else { cout << "��������� � ������� " << key << " �� ������\n"; } } else if (cmd == 3) { int key; cout << "������� ��������� ����� ��� ��������: "; cin >> key; if (tree.search(key)) { tree.remove(key); cout << "��������� � ������� " << key << " �����\n"; } else { cout << "��������� � ������� " << key << " �� ������\n"; } } else if (cmd == 4) { string filename; cout << "������� ��� �����: "; cin >> filename; loadFromFile(tree, filename); } else if (cmd == 5) { cout << "\n=== ���������� ������ ===\n"; tree.printAscending(); } else if (cmd == 9) { testInsertAndSearch(); testDelete(); } } while (cmd != 0); cout << "��������� ���������\n"; return 0; }