#include #include #include #include #include #include #include using namespace std; int hhmmssTosec(string time) { return ((stoi(time.substr(0, 2)) * 3600) + (stoi(time.substr(3, 2)) * 60) + stoi(time.substr(6, 2))); } int main(){ map > > a; ifstream fin("sisend1.txt"); string line, kust, kuhu, aegstr; getline(fin, line); getline(fin, line); getline(fin, line); while(!fin.eof()){ stringstream ss(line); ss >> kust >> kuhu >> aegstr; a[kust].push_back(make_pair(kuhu, hhmmssTosec(aegstr))); getline(fin, line); } //cout << a["200"][1].second; for(map > >::iterator it=a.begin(); it!=a.end(); it++){ cout << it->first << ":"; for(int i=0; isecond.size(); i++){ cout << it->second[i].first << "-" << it->second[i].second << " "; } cout << endl; } return 0; } //Lugege andmed failist map-i //g++ -std=c++11 2.cpp