-
Notifications
You must be signed in to change notification settings - Fork 0
/
OnlinePlayer.cpp
61 lines (43 loc) · 1.77 KB
/
OnlinePlayer.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
#include "OnlinePlayer.h"
#include "utils.h"
OnlinePlayer::OnlinePlayer() : virtual_name("unknown"), email("[email protected]") {}
OnlinePlayer::~OnlinePlayer() {}
void OnlinePlayer::readFromConsole() {
Player::readFromConsole();
//int playerAge = getAge();
//std::cout << "Ââåäèòå îïûò ðàáîòû ñóäüè (â ãîäàõ): ";
//experience = InputNum<int>(0, playerAge);
std::cout << "Ââåäèòå íèê: ";
std::cin.ignore();
std::getline(std::cin, virtual_name);
std::cout << "Ââåäèòå àäðåñ ïî÷òû: ";
std::cin.ignore();
std::getline(std::cin, email);
std::cout << "Ââåäèòå íîìåð òåëåôîíà â âèäå 9991010010: (+7)";
tel = InputNum<unsigned long long int>(1000000000, 9999999999);
/*std::cout << "Ââåäèòå óðîâåíü êâàëèôèêàöèè\n(Âñåðîññèéñêàÿ = 0| Ïåðâàÿ = 1| Âòîðàÿ = 2| Òðåòüÿ = 3| Þíûé ñóäüÿ = 4): ";
int levelInput = InputNum<int>(0, 4);
switch (levelInput){
case 0: { level = "Âñåðîññèéñêàÿ"; break; }
case 1: { level = "Ïåðâàÿ"; break; }
case 2: { level = "Âòîðàÿ"; break; }
case 3: { level = "Òðåòüÿ"; break; }
case 4: { level = "Þíûé ñóäüÿ"; break; }
}*/
}
void OnlinePlayer::displayToConsole() const {
Player::displayToConsole(); // Ñíà÷àëà âûâîäèì äàííûå áàçîâîãî êëàññà
std::cout << "Íèê ïîëüçîâàòåëÿ: " << virtual_name << ", Àäðåñ ïî÷òû: " << email << ", Íîìåð òåëåôîíà: +7" << tel << std::endl;
}
void OnlinePlayer::readFromFile(std::ifstream& inputFile) {
inputFile.ignore();
std::getline(inputFile, virtual_name);
inputFile.ignore();
std::getline(inputFile, email);
inputFile >> tel;
}
void OnlinePlayer::writeToFile(std::ofstream& outputFile) const {
outputFile << virtual_name << std::endl
<< email << std::endl
<< tel << std::endl;
}