[C++]Retrieve object data from multimap with values from csv -


i have multi-map key want date object , value variables struct . data/met_index store file name , program open files file name in text file.in time , date class have overload operator.

i able insert map have no clue on how when tried iterator(as shown below) returns me 'error: cannot bind 'std::basic_ostream' lvalue 'std::basic_ostream&&'|'

also , how can binary search through map.

i new language need guidance on this.

using namespace std; typedef struct { time t; float speed; int solar; } windlogtype; date d; multimap<date, windlogtype> windlog; ifstream input, csv; ofstream output; int choice, number; string filename, savedfile; string *filelist = null; windlogtype t1;   int main() { output.open("data/met_index.txt"); cout << "enter number of file read : " << endl; cin >> number ; for(int =0; i< number ; i++) {     cout << "enter file name : " << endl;     cin >> filename;     output << filename << endl; } filelist = new string[number]; output.close(); input.open("data/met_index.txt", ios::in); if(!input.is_open()) {     cout<< "file not found."<<endl;     return 0; } else {     string line, line2;     while(getline(input, line, '\n'))     {         //cout << line << endl;         line = "data/" + line;         for(int =0; i<number; i++)         {             filelist[i] = line;             cout << filelist[i];             csv.open(filelist[i].c_str());                string line,sday, smonth, syear, shh, smm;              while(getline(csv,line2, ';' ))             {                 //cout << line2 << endl;                 getline(csv, sday,'/');                 getline(csv, smonth,'/');                 getline(csv, syear,' ');                  getline(csv, shh,':');                 getline(csv, smm,',');                  int day1 = atoi(sday.c_str());                 int month1 = atoi(smonth.c_str());                 int year1 = atoi(syear.c_str());                 int hour1 = atoi(shh.c_str());                 int min1 = atoi(smm.c_str());                 float s1;                 int sr;                 (int i=0; i<10; i++)                 {                     csv >> s1;                     csv.ignore(100, ',');                 }                 for(int j =0; j<18; j++)                 {                     csv >> sr;                     csv.ignore(50,',');                 }                 t1.t.settime(hour1, min1);                 t1.speed = s1;                 t1.solar = sr;                 d.setdate(day1, month1, year1);                 windlog.insert(pair<date, windlogtype>(d, t1));                 multimap<date, windlogtype> :: iterator it;                 for(it =windlog.begin(); it!= windlog.end(); ++it)                {                     cout<< (*it).first <<" " << (*it).second << '\n';                 }                           }             csv.close();          }      }     input.close();     input.clear();     //input.open(filelist[0].c_str(), ios::in);  }  return 0; } 


Comments