#include<iostream>
#include<fstream>
#include<sstream>
using namespace std;

int main(void) {
      float a[3];
      ifstream fp;
      string data;
      
      try {
          fp.open("test.cvs");
          if (!fp.good()) {
                cerr<< "file not found!" <<endl;
                exit(-1);
          }
          while (true) {
              //  getline(fp,data);
               // fp>> ss;
               
                fp>> data;
                if (fp.eof()) break;
                istringstream ss(data);
                int count=0;
                while (ss) {
                string s;
              
                if (!getline(ss,s,',')) break;
                           // cout << s<< endl;
                            
                            a[count]=stof(s);
                            count++;

                }
                // cout<<data<< endl;
                
         } 
         fp.close();
      }catch (...) {    
          cerr<< "error reading file!" <<endl;
      }
      for (int i=0;i<3; i++) {
          cout << a[i]<<endl;
      }
      
  return 0;
}
