Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create 10 user groups (both Linux and Windows - at least one user account per group) appropriate for the needs of this company #include #include
Create 10 user groups (both Linux and Windows - at least one user account per group) appropriate for the needs of this company #include #include using namespace std; struct node { node() {}; node(int val) :val(val) {}; int val; node* prev; node* next; }; class list { public: list() { head = new node; head->next = head; head->prev = head; } void display(); void push_front(const int& value); void push_back(const int& value); void pop_front(); void pop_back(); unsigned int size() const; bool empty() const; void clear(); private: node* head; }; int main() { list marc; marc.push_front(1); marc.push_front(2); marc.display(); cout << \"The size of the list is: \" << marc.size() << endl; marc.push_back(3); marc.push_back(4); marc.display(); cout << \"The size of the list is: \" << marc.size() << endl; marc.pop_front(); marc.pop_back(); marc.display(); cout << \"The size of the list is: \" << marc.size() << endl; marc.clear(); marc.empty(); } unsigned int list::size() const { unsigned int _size(0); node* nptr; for (nptr = head->next; nptr != head; nptr = nptr->next) _size++;; return _size; } void list::push_front(const int& value) { node* nptr; nptr = new node(value); nptr->next = head->next; head->next->prev = nptr; head->next = nptr; nptr->prev = head; } void list::push_back(const int& value) { node* nptr; nptr = new node(value); nptr->next = head; head->prev->next = nptr; nptr->prev = head->prev; head->prev = nptr; } void list::pop_front() { node* nptr; if (head->next) { head->next->next->prev = head; head->next = head->next->next; } } void list::pop_back() { node* nptr; if (head->prev) { head->prev->prev->next = head; head->prev = head->prev->prev; } } bool list::empty() const { if (head->next == head && head->prev == head) { return true; } else { return false; } } void list::clear() { node* nptr; head->prev->next = NULL; nptr = NULL; while (head != NULL) { nptr = head; head = head->next; delete nptr; } cout << \"All nodes are deleted successfully. \"; } void list::display() { node* nptr; cout <<\"The list now is\" << endl; for (nptr = head->next; nptr != head; nptr = nptr->next) cout << nptr->val
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started