Repository navigation
Expand file tree
/
Copy pathfunction.cpp
More file actions
88 lines (73 loc) · 2.39 KB
/
Copy pathfunction.cpp
File metadata and controls
88 lines (73 loc) · 2.39 KB
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
79
80
81
82
83
84
85
86
87
88
#include "function.h"
#include <sstream>
#include <Windows.h>
#include <iostream>
using std::cout;
using std::cin;
HANDLE hConsole, hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
std::string intToString(int num){
std::string value;
std::stringstream ss;
ss << num;
ss >> value;
return value;
}
std::string floatToString(float num){
std::string value;
std::stringstream ss;
ss << num;
ss >> value;
return value;
}
void SetColor(int text, int background) {
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hStdOut, (WORD)((background << 4) | text));
}
void GotoXY(int X, int Y) {
COORD coord = { X, Y };
SetConsoleCursorPosition(hStdOut, coord);
}
employee creationEmployee(){
std::string secName;
unsigned int codePosition;
std::string subdivision;
unsigned int hoursWorked;
cout << "Ââåäèòå èìÿ: ";
cin >> secName;
cout << "Ââåäèòå êîä äîëæíîñòè: ";
cin >> codePosition;
cout << "Ââåèòå ïîäðàçäååíèå: ";
cin >> subdivision;
cout << "Ââåäèòå êîë-âî îòðàáîòàííûõ ÷àñîâ: ";
cin >> hoursWorked;
employee newEmpl(0, secName, codePosition, subdivision, hoursWorked);
return newEmpl;
}
jobInfo creationJobInfo(){
std::string jobTitle;
float salary;
cout << "Ââåäèòå íàèìåíîâàíèå ïðîôåññèè: ";
cin >> jobTitle;
cout << "Ââåäèòå Ç/Ï â ÷àñ: ";
cin >> salary;
jobInfo newJobInfo(0, jobTitle, salary);
return newJobInfo;
}
std::ostream & operator<<(std::ostream & o, const std::vector<employee>::iterator& empl){
o << "+------------------------------------------------------------------------------+";
o << "|ID: " << empl->id << "\n";
o << "|Èìÿ: " << empl->secName << "\n";
o << "|Êîä äîëæíîñòè: " << empl->codePosition << "\n";
o << "|Ïîäðàçäåëåíèå: " << empl->subdivision << "\n";
o << "|Êîë-âî îòðàáîòàííûõ ÷àñîâ: " << empl->hoursWorked << "\n";
o << "+------------------------------------------------------------------------------+";
return o;
}
std::ostream& operator << (std::ostream &o, const std::vector<jobInfo>::iterator& record) {
o << "+------------------------------------------------------------------------------+";
o << "ID: " << record->id << "\n";
o << "Íàèìåíîâàíèå äîëæíîñòè: " << record->jobTitle << "\n";
o << "Ç/Ï: " << record->salary << "\n";
o << "+------------------------------------------------------------------------------+";
return o;
}