title: (c++11) reading a file while simultaneously saving each each word in the file to a given vector
body: <p>So to start off, the goal of this function below is to read each line in the text file (TitanData.txt). Each line has 3 pieces of information: Age, Passenger Class, and if the passenger survived (saved as &quot;TRUE&quot; or &quot;FALSE&quot;) in order. I've created 3 vectors: vector Age, vector PassengerClass, vector Survived. The issue seems to be that the push_back functions aren't working properly. I've been looking for solutions for hours and I have yet to come across one so hopefully I can get an answer here.</p>
  <p>The function is below:</p>
  <pre><code>void ReadFromFile(vector&lt;int&gt; Age, vector&lt;string&gt; PassengerClass, vector&lt;bool&gt; Survived)
  {
      bool survived;
      int age;
      string Passenger_Class;
  
      string val1, val2, val3;
      ifstream infile;
      infile.open(&quot;TitanicData.txt&quot;);
      if (infile)
      {
          while (infile &gt;&gt; val1 &gt;&gt; val2 &gt;&gt; val3)
          {
              age = stoi(val1);
              Age.push_back(age);
  
  
              Passenger_Class = val2;
              PassengerClass.push_back(val2);
  
  
              if (val3 == &quot;TRUE&quot;)
              {
                  survived = true;
                  Survived.push_back(true);
              }
              if (val3 == &quot;FALSE&quot;)
              {
                  survived = false;
                  Survived.push_back(false);
              }
          }
          infile.close();
      }
  }
  </code></pre>