我不知道以下代码有什么问题,它应该读取数字并将它们的值与位置放在一个成对的向量中,然后对它们进行排序并打印出位置。我用排序删除了该部分 - 我认为问题在那里,但我再次收到编译错误。
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
int main(void)
{
unsigned int n,d,a[65],b[65],s,i,j,t,us=0;
pair<unsigned int,unsigned int> temp;
vector< pair<unsigned int,unsigned int> > v;
cin >> n;
for(i=0;i<n;i++)
{
cin >> t;
temp(t, i+1);
v.push_back(temp);
}
cin >> d;
for(i=0;i<d;i++) cin >> a[i] >> b[i];
for(i=0;i<v.size();i++)
{
cout << v[i].first << " -- " << v[i].second << endl;
}
return 0;
}
请告诉我问题出在哪里。谢谢。