大佬们 我这哪里错了呀
#include<iostream>
#include<list>
using namespace std;
int intersection(list<int>L, list<int>P, int a[]);
int cou = 0;
int a[10];
int main()
{
list<int>L;
list<int>P;
L.push_back(1);
L.push_back(3);
L.push_back(4);
L.push_back(6);
P.push_back(1);
P.push_back(2);
P.push_back(3);
P.push_back(4);
P.push_back(5);
P.push_back(6);
P.push_back(7);
intersection(L, P,a);
for(int j=0;j<cou;j++)
{
cout << a[j] << endl;
}
getchar();
}
int intersection(list<int>L,list<int>P,int a[ ])
{
int i = 0;
for (list<int>::iterator itrl = L.begin();;++itrl)
{
for (list<int>::iterator itrp = P.begin();*itrp<=*itrl; ++itrp)
{if(*itrl=*itrp)
{
a[i] = *itrl;
i++;
cou++;
}
}
}
return cou;
}