Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void EmployeesTree::AddEmployees(std::queue<Employee> employees)
- {
- while (!employees.empty())
- {
- Employee newEmployee = employees.front();
- employees.pop();
- Node *curentNode = root;
- root->undersCount++;
- while (curentNode->positionID + 1 != newEmployee.GetPositionID() && !curentNode->subordinates.empty())
- {
- int minSubsIndex = FindLowestEmpCount(curentNode->subordinates);
- curentNode = curentNode->subordinates[minSubsIndex];
- curentNode->undersCount++;
- }
- if (curentNode->positionID + 1 != newEmployee.GetPositionID() && curentNode->subordinates.empty())
- {
- std::cout << "Can't find position for " << newEmployee.GetName() << " (position: " << newEmployee.GetPosition() << ")\n";
- continue;
- }
- curentNode->subordinates.push_back(new Node(newEmployee));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement