Write a program below |
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
struct people {
string firstname, secondname;
};
bool cmp(people first, people second) {
|
|
}
int main() {
int N;
cin >> N;
vector<people> A (N);
for(int i = 0; i < N; i++)
cin>>A[i].firstname>>A[i].secondname;
sort(A.begin(), A.end(), cmp );
for(int i = 0;i< N; i ++)
cout<<A[i].firstname<<" "<<A[i].secondname<<endl;
}
|