istringstream 读入一整行,并按空格分开,挨个输出
题
#include<bits/stdc++.h>
using namespace std;
int r;
struct Task{
string nam, day, start;
double time;
string line;
};
bool cmp(Task a, Task b){
if(a.time != b.time) return a.time < b.time;
else if(a.day != b.day) return a.day < b.day;
else return a.start < b.start;
}
int main()
{
string s;
vector<Task>t;
while(getline(cin, s)){
Task temp;
temp.line = s;
istringstream isline(s);
isline>>temp.nam>>temp.day>>temp.start>>temp.time;
t.push_back(temp);
}
sort(t.begin(), t.end(), cmp);
for(auto it:t){
cout<<it.line<<endl;
}
return 0;
}