title: String values not matching C++
body: <p>Hi generous people of StackExchange,</p>
  
  <p>I'm working with C++ and I've seemed to run into the error of not being able to match two string values properly. I have the code in main:</p>
  
  <pre><code>/**
  *   Author: Kevin Hill
  *   Assignment: Project5
  *   Description: VehicleDB
  **/
  
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;fstream&gt;
  #include &lt;stdlib.h&gt;
  #include "Vehicle.h"
  //#include "Truck.h"
  //#include "Car.h"
  
  using namespace std;
  
  bool checkLine(string, string);
  
  int main(int argc, char const *argv[])
  {
  
      string fileName; //This is the file name
       //Vehicle array
      ifstream file; //Instantiate file
      string sLine;
      Vehicle **vehArr;
  
      //Tell user to enter data
      cout &lt;&lt; "Enter the file name: ";
      cin &gt;&gt; fileName;
      file.open(fileName.c_str());
      if(!file.is_open()){
          cerr &lt;&lt; "The file is not there" &lt;&lt; endl;
          return 1;
      }
  
  
      //Get first line of file to determine size of vehArr    
      for (int i = 0; !file.eof(); ++i)
      {
          if (i == 0){
              getline(file, sLine); 
              break;
          }
      }
  
      int arrSize = atoi(sLine.c_str());
      vehArr =  new (nothrow) Vehicle*[arrSize];
      string truck = "truck";
      string car = "car";
      while(!file.eof()){
          getline(file, sLine);
          string stuff = sLine;
          checkLine(stuff, car);
      }
  
      // Test add Truck and Car objects
      // vehArr[0] = new Car(file);
      // vehArr[1] = new Truck();
  
      string theLine = "";
  
      // checkLine("one", "one");
  
      // cout &lt;&lt; "Beginning loop" &lt;&lt; endl;
  
      // for (int i = 0; !file.eof(); ++i){
      //  getline(file, theLine);
  
  
  
      //  // if(theLine == "car"){
      //  //  vehArr[i] = new Car(file);
      //  //  i++;
      //  // }
      //  // if (theLine == "truck"){
      //  //  vehArr[i] = new Truck(file);
      //  //  i++;
      //  // }
      //  // if (i == arrSize){
      //  //  break;
      //  // }    
      // }
  
      return 0;
  }
  
  bool checkLine(string one, string two){
  
      // if (one == two)
      // {
      //  /* code */
      // }
  
  
  
      if (one == two)
      {
          cout &lt;&lt; "It's a " &lt;&lt; two &lt;&lt; endl;
      }
      // cout &lt;&lt; one &lt;&lt; endl;
      // cout &lt;&lt; two &lt;&lt; endl;
  
      return true;
  }
  </code></pre>
  
  <p>As you can see, I commented the code out to get rid of all the stuff that's not important for my problem. When I read my file I try to make a match of all the lines that equal car. It should work because I tried having all lines equal themselves and that worked, but having the lines equal <code>car</code> alone just didn't work out. I'm now stuck on this one thing.</p>
  
  <p>This is the text file it's reading from:</p>
  
  <pre><code>5
  car
  11111
  Ford
  Fusion FWD
  Red
  24999.00
  3
  AC
  795.00
  XM
  295.00
  Leather Seats
  495.00
  20
  28
  car
  22222
  Volvo
  V70 FWD
  White
  42999.00
  2
  Child Seats
  198.00
  17" wheels
  698.00
  14
  22
  car
  33333
  Honda
  Accord
  Silver
  19999.00
  1
  Tinted Windows
  175.00
  22
  31
  truck
  44444
  Freightliner
  FLD SD
  Red
  119999.00
  1
  Detroit Diesel Series 60
  4999.00
  10 speed manual
  455
  truck
  55555
  Mack
  TerraPro Cabover MRU612
  White
  125000.00
  1
  Dual Air Brake System
  6000.00
  8 speed manual
  325
  </code></pre>
  
  <p>It's necessary for me to actually complete my assignment, but I can't figure out how fix this. Please help me.</p>