-
Notifications
You must be signed in to change notification settings - Fork 0
/
oop_GershA.cpp
78 lines (69 loc) · 2.11 KB
/
oop_GershA.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "PlayerContainer.h"
#include "utils.h"
#include <iostream>
#include <cstdlib>
#include <boost/serialization/export.hpp>
int main() {
setlocale(LC_ALL, "");
std::system("chcp 1251");
//std::locale::global(std::locale("rus_rus.866"));
//wcin.imbue(std::locale());
//wcout.imbue(std::locale());
PlayerContainer container;
int choice;
do {
std::cout << "Ñèñòåìà øàõìàòíîãî òóðíèðà\n";
std::cout << "1. Äîáàâèòü èãðîêà\n";
std::cout << "2. Äîáàâèòü Îíëàéí èãðîêà\n";
std::cout << "3. Âûâåñòè âñåõ èãðîêîâ\n";
std::cout << "4. Çàãðóçèòü èãðîêîâ èç ôàéëà\n";
std::cout << "5. Ñîõðàíèòü èãðîêîâ â ôàéë\n";
std::cout << "6. Î÷èñòèòü âñåõ èãðîêîâ\n";
std::cout << "0. Âûõîä\n";
std::cout << "Ââåäèòå âàø âûáîð: ";
choice = InputNum<int>(0, 6);
switch (choice) {
case 1: {
container.addPlayer();
break;
}
case 2: {
container.addOnlinePlayer();
break;
}
case 3: {
container.displayPlayers();
break;
}
case 4: {
std::string filename;
std::cout << "Ââåäèòå íàçâàíèå ôàéëà: ";
std::cin.clear();
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
std::getline(std::cin, filename);
container.readFromFile(filename);
break;
}
case 5: {
std::string filename;
std::cout << "Ââåäèòå íàçâàíèå ôàéëà: ";
std::cin.clear();
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
std::getline(std::cin, filename);
container.writeToFile(filename);
break;
}
case 6:
container.clearPlayers();
break;
case 0:
exit(0);
break;
default:
std::cout << "Íåâåðíûé âûáîð! Ïîâòîðèòå ââîä.\n";
}
} while (choice != 0);
return 0;
}
BOOST_CLASS_EXPORT(OnlinePlayer)
BOOST_CLASS_EXPORT(Player)