#include <QCoreApplication>
#include <QMultiMap>
#include <QtCore/QFile>
#include <QTextStream>
#include <QStringList>
#include <iostream>
#include <QDebug>
#include <QDir>
#include <QByteArray>
#include <QTime>
using namespace std;
int main(int argc, char *argv[])
{
qDebug() << file.fileName() << file.error() << file.errorString();
return 0;
}
begin = begin.currentTime();
myTimer.start();
int count = 0;
/*while (!in.atEnd()) {
QString line = in.readLine();
QStringList list1 =line.split(' ');
pair1.first = list1[0];
pair1.second = list1[1];
map1.insert(pair1, list1[2]);
cout << count++ << "\n";
}*/
while (!in.atEnd()) {
map2.insert(list1[1], list1[2]);
map3.insert(list1[0], map2);
cout << count++ << "\n";
}
end = end.currentTime();
cout << begin.hour() << ":" << begin.minute() << ":" << begin.second() << " " << myTimer.elapsed() << " " << end.hour() << ":" << end.minute() << ":" << end.second() << "\n";
return 0;
}
#include <QCoreApplication>
#include <QMultiMap>
#include <QtCore/QFile>
#include <QTextStream>
#include <QStringList>
#include <iostream>
#include <QDebug>
#include <QDir>
#include <QByteArray>
#include <QTime>
using namespace std;
int main(int argc, char *argv[])
{
QTime myTimer;
QCoreApplication a(argc, argv);
QPair < QString, QString > pair1;
QMap< QPair < QString, QString >, QString > map1;
QMap< QString, QString > map2;
QMap< QString, QMap< QString, QString > > map3;
QString id, time, value;
QFile file("File2.txt");
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
qDebug() << file.fileName() << file.error() << file.errorString();
return 0;
}
QTime begin, end;
begin = begin.currentTime();
QTextStream in(&file);
myTimer.start();
int count = 0;
/*while (!in.atEnd()) {
QString line = in.readLine();
QStringList list1 =line.split(' ');
pair1.first = list1[0];
pair1.second = list1[1];
map1.insert(pair1, list1[2]);
cout << count++ << "\n";
}*/
while (!in.atEnd()) {
QString line = in.readLine();
QStringList list1 =line.split(' ');
map2.insert(list1[1], list1[2]);
map3.insert(list1[0], map2);
cout << count++ << "\n";
}
end = end.currentTime();
cout << begin.hour() << ":" << begin.minute() << ":" << begin.second() << " " << myTimer.elapsed() << " " << end.hour() << ":" << end.minute() << ":" << end.second() << "\n";
return 0;
}
To copy to clipboard, switch view to plain text mode
Bookmarks