title: C++ How to check if user input is the same as in a file?
body: <p>I want to check if the value the user inputs is in the file that i have opened.</p>
  
  <p>i am doing a taxi booking system.</p>
  
  <p>user input = userTime  (the time the user wants picking up from the taxi)</p>
  
  <p>i am trying to check if this time is already next to all of the drivers (4)</p>
  
  <p>in my file i have
  driver name,<br>
      driver number,<br>
   time booked</p>
  
  <p>if userTime is the same as time booked on all 4 drivers in the file then the system will say no drivers available for the time required</p>
  
  <p>it is in 24hr time so userTime would match exactly to the file contents in time booked. e.g 1200 = 12pm</p>
  
  <p>please help soon thank you p.s. i am new to c++</p>
  
  <p>here is my code so far, a function. it says 'expression must have pointer to object type' on the second instance of cab. and also the two [i]s on the cab.timeBooked 's. what is wrong with it please ?</p>
  
  <pre><code>struct Driver
  {
      string firstName;
      double number;
      int timeBooked;
  };
  
  
  struct Driver cab;  
  
  void searchDrivers()
      {
          cout &lt;&lt; "\nSearching for drivers..." &lt;&lt; endl;
          ifstream inFile;
          inFile.open("drivers.txt");
          if (!inFile)
          {
              cout &lt;&lt; "error reading file";
          }
          else
          {
              for (int i = 0; i &lt; 4; i++)
              {
                  inFile &gt;&gt; cab.firstName[i] &gt;&gt; cab.number[i] &gt;&gt; cab.timeBooked[i];
                  if (userTime2 == cab.timeBooked[i])
                  {
                      cout &lt;&lt; "unavailable" &lt;&lt; endl;
                  }
                  else
                  {
                      cout &lt;&lt; "car available" &lt;&lt; endl;
                      driverIndex = i;
                      confirmBooking();
                  }
              }
          }
  
      }
  </code></pre>