title: C++ Class that contains two functions. Allocating memory in main
body: <p>so I'm trying to solve the following task:</p>
  <p><a href="https://i.stack.imgur.com/KZPN4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KZPN4.png" alt="Task" /></a></p>
  <p>Below is the code that I've come up with. I'm having trouble storing the data correctly and I'm not sure where to put the read() and output() function. This probably isn't all too difficult but I'm still not sure. Can somebody maybe give me a hint? Thank you!</p>
  <pre><code> #include &lt;iostream&gt;
  #include &lt;iomanip&gt;
  
  using namespace std;
  
  class Employee
  {
  public:
      string name, department;
      int age;
  
      void output(string &amp;a, int &amp;b, string &amp;c)
      {
          cout &lt;&lt; name &lt;&lt; endl;
          cout &lt;&lt; &quot;Age: &quot; &lt;&lt; age &lt;&lt; &quot; years&quot; &lt;&lt; endl;
          cout &lt;&lt; &quot;Department: &quot; &lt;&lt; department &lt;&lt; endl;
      }
  
      void read(int &amp;n)
      {
              cout &lt;&lt; &quot;Enter number, last name and first name:&quot;;
              cin &gt;&gt; name;
  
              cout &lt;&lt; &quot;Enter age:&quot;;
              cin &gt;&gt; age;
  
              cout &lt;&lt; &quot;Enter department:&quot;;
              cin &gt;&gt; department;
          }
  };
  
  int main() {
      int n;
      cout &lt;&lt; &quot;Enter number of employees: &quot;;
      cin &gt;&gt; n;
      Employee* o = new Employee;
      Employee employee;
  
  
  
     delete o;
  }
  </code></pre>