title: C++ how to read a file and print certain part only to the screen
body: <p>I need my program to read a file with a format as following:</p>
  
  <pre><code>latitude,longitude,address,city,state,zip,phone,college,district,website
  34.9438553,-120.4214783,800 S College Dr,Santa Maria,CA,93454, 805.922.6966,ALLAN HANCOCK COLLEGE, Allan Hancock Joint Community College District, www.hancockcollege.edu
  38.649353,-121.3482895,4700 College Oak Dr,Sacramento,CA,95841, 916.484.8011,AMERICAN RIVER COLLEGE, Los Rios Community College District, www.arc.losrios.edu
  34.6749175,-118.1843197,3041 W Avenue K,Lancaster,CA,93536, 661.722.6300,ANTELOPE VALLEY COLLEGE, Antelope Valley Community College District, www.avc.edu
  35.4108801,-118.9736161,1801 Panorama Dr,Bakersfield,CA,93305, 661.395.4011,BAKERSFIELD COLLEGE, Kern Community College District, www.bakersfieldcollege.edu
  34.8708435,-117.0210879,2700 Barstow Rd,Barstow,CA,92311, 760.252.2411,BARSTOW COLLEGE, Barstow Community College District, www.barstow.edu
  37.8699917,-122.2700007,2050 Center St,Berkeley,CA,94704, 510.981.2800,BERKELEY CITY COLLEGE, Peralta Community College District, www.berkeley.peralta.edu
  39.6462028,-121.6477912,3536 Butte Campus Dr,Oroville,CA,95965, 530.895.2511,BUTTE COLLEGE, Butte-Glenn Community College District, www.butte.edu
  36.9915657,-121.9243927,6500 Soquel Dr,Aptos,CA,95003, 831.479.6100,CABRILLO COLLEGE, Cabrillo Community College District, www.cabrillo.edu
  </code></pre>
  
  <p>I want to console out only the latitude and longitude of each college, which is the first and second set of numbers separated by comma for each line. </p>
  
  <p>i.e: 34.9438553 and -120.4214783 for S College Dr</p>
  
  <p>I figured out how to read the whole text, but I could not figure out how to read only certain parts of the text.</p>
  
  <p>Below is my first attempt, nothing fancy, just read the whole text because I did not know where to go from here. Please help me, I'm lost</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  int main(int argc, const char * argv[])
  {
      string line;
      ifstream myfile ("cccGeoList.txt");
      if (myfile.is_open())
      {
          while (!myfile.eof())
          {
              getline(myfile, line);
              cout &lt;&lt; line &lt;&lt; '\n';
          }
          myfile.close();
      }
  
      else cout &lt;&lt; "Unable to open file";
  </code></pre>