如题,打出了这样一份代码,但是无法通过编译,且错误信息很长。
#include <bits/stdc++.h>
using namespace std;
struct xiaofei
{
int u,v;
}a[12];
bool cmp(xiaofei a,xiaofei b)
{
if (a.u==b.u)
{
return a.v<b.v;
}
else
{
return a.u<b.u;
}
}
int main()
{
for (int i=1;i<=10;i++)
{
cin >> a[i].u >> a[i].v;
}
sort (a+1,a+11,cmp);
int cnt=unique(a+1,a+11)-a-1;
cout << cnt << endl;
for (int i=1;i<=cnt;i++)
{
cout << a[i].u << " " << a[i].v << endl;
}
return 0;
}
谢谢![爱心]