title: Reading from an Excel file
body: <p>I am trying to read from an Excel file that has four columns and 121 rows. I tried the .csv idea, but I guess I understood it wrong because when I compile this, it gets all messed up.  </p>
  
  <p>How can I make sure city gets the first cell, country gets second, lon gets third, and lat gets fourth?</p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  int main()
  {
  ifstream inFile;
  
  string city;
  string country;
  string lat;
  string lon; 
  inFile.open("worldcities.csv");
  if (inFile.is_open()) {
      cout &lt;&lt; "File has been opened" &lt;&lt; endl;
  }
  else {
      cout &lt;&lt; "NO FILE HAS BEEN OPENED" &lt;&lt; endl;
  }
  
  
  while (!inFile.eof()) {
      inFile &gt;&gt; city;
      inFile &gt;&gt; country;
      inFile &gt;&gt; lon;
      inFile &gt;&gt; lat;
      cout &lt;&lt; "City: " &lt;&lt; city &lt;&lt; endl;
      cout &lt;&lt; "Country: " &lt;&lt; country &lt;&lt; endl;
      cout &lt;&lt; "Lat: " &lt;&lt; lat &lt;&lt; endl;
      cout &lt;&lt; "Lon: " &lt;&lt; lon &lt;&lt; endl;
  }
  inFile.close();
  system("pause");
  return 0;
  } 
  </code></pre>