title: Vector of structs: adding elements C++
body: <p>I am reading my structs from a file, and I would like to add them to vector of structs.
  Here is how it looks and works:</p>
  
  <pre><code>    typedef struct
  {
      int ID;
      string name;
      string surname;
      int points;
  }
  Student;
  
  int main()
  {
      ifstream theFile("test.txt");
      std::vector&lt;Student*&gt; students;
  
      Student* s = new Student();
  
      while(theFile &gt;&gt; s-&gt;ID &gt;&gt; s-&gt;name &gt;&gt; s-&gt;surname &gt;&gt; s-&gt;points)
      {
          studenti.push_back(s); // here I would like to add this struct s from a file
      }
  
  // here I want to print each struct's values on the screen, but the output is always ONLY last struct N times, and not all of them, each only once
  
  
      std::vector&lt;Student*&gt;::const_iterator it;
      for(it = students.begin(); it != students.end(); it+=1)
      {
          std::cout &lt;&lt; (*it)-&gt;ID &lt;&lt;" " &lt;&lt; (*it)-&gt;name &lt;&lt; " " &lt;&lt; (*it)-&gt;surname &lt;&lt;" " &lt;&lt; (*it)-&gt;points &lt;&lt;endl;
      }
  </code></pre>
  
  <p>What should I do so I can add my structs to a vector, and print them out normally (this print is only a check really, if the structs are properly loaded into vector)?</p>