title: Moving data from one queue to another queue
body: <p>I dequeue a queue and if the employee's salary is less than 50,000. I am not sure how to enqueue it into another queue as my enqueue function takes three parameters. My assignment says to create a class and then two queues in main. I made the queues being an object of the class, is this correct? How do I enqueue into the second queue with only having one enqueue function in the class which takes three parameters. Thanks for all the help. </p>
  
  <pre><code>#include &lt;cstdlib&gt;
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;iomanip&gt;
  using std::cout;
  using std::cin;
  using std::endl;
  using std::string;
  using std::fixed;
  using std::setprecision;
  
  struct node{
      string name;
      int id;
      int salary;
      struct node *next;
  };
  
  node *rear;
  node *front;
  
  class DynEmpQueue{
  private:
      int counter = 0;
  public:
      void enqueue(string, int, int);
      void dequeue();
      void traverse()const;
      DynEmpQueue()
      {
          rear = nullptr;
          front = nullptr;
          counter = 0;
      }
  };
  
  void DynEmpQueue::enqueue(string localName, int localID, int localSalary)
  {
      node *temp;
      temp = new (struct node);
      temp -&gt; name = localName;
      temp -&gt; id = localID;
      temp -&gt; salary = localSalary;
      temp -&gt; next = nullptr;
      if (front == nullptr)
          front = temp;
      else
          rear -&gt; next = temp;
      rear = temp;
      counter++;
  }
  
  void DynEmpQueue::dequeue()
  {
      string localName;
      int localID;
      int localSalary;
      node *temp;
      if (front == nullptr)
          cout &lt;&lt; "The queue is empty.";
      else
      {
          temp = front;
          localName = temp -&gt; name;
          localID = temp -&gt; id;
          localSalary = temp -&gt; salary;
          front = front -&gt; next;
          delete temp;
          counter--;
      }
  }
  
  void DynEmpQueue::traverse()const
  {
      node *temp;
      temp = front;
      if (front == nullptr)
          cout &lt;&lt; "Queue is empty.";
      else
      {
          cout &lt;&lt; "Queue contains " &lt;&lt; counter &lt;&lt; " elements." &lt;&lt; endl;
          cout &lt;&lt; "Queue elements:" &lt;&lt; endl;
          while (temp != nullptr)
          {
              cout &lt;&lt; temp -&gt; name &lt;&lt; "\t" &lt;&lt; temp -&gt; id &lt;&lt; "\t" &lt;&lt; temp -&gt; salary &lt;&lt; endl;
              temp = temp -&gt; next;
          }
      }
  }
  
  int main()
  {
      const int NumberEmployees = 5;
      DynEmpQueue originalQueue;
  
      originalQueue.enqueue("Justin Gray", 100, 104000);
      originalQueue.enqueue("Mike Smith", 200, 207000);
      originalQueue.enqueue("Jose Cans", 400, 47000);
      originalQueue.enqueue("Auston Matts", 300, 31000);
      originalQueue.enqueue("Liz Learnerd", 600, 89100);
  
      node object;
      DynEmpQueue demandSalaryIncrease;
  
      for (int i = 0; i &lt; NumberEmployees; i++)
      {
          originalQueue.dequeue();
          if (object.salary &lt;= 50000)
              demandSalaryIncrease.enqueue();
      }
  
      demandSalaryIncrease.traverse();
  
      return 0;
  }
  </code></pre>