thanks....
I worked it out.
But I have a function that gives me the intersection of 2 vectors. But I dont know the return types of this function.
I want to pass the value returned by the Intersection function to another function but get an error as
error: invalid conversion from 'int (*)()' to 'int'
The Intersection function is
Code:
int Intersection()
{
set<int>::iterator it;
set<int>::iterator iterr;
sort (v1.begin(), v1.begin()+v1.size());
sort (v2.begin(), v2.begin()+v2.size());
set_intersection (v1.begin(), v1.begin()+v1.size(),v2.begin(), v2.begin()+v2.size(), v.begin());
set<int> vset(v.begin(), v.end());
set<int>newset(v1.begin(),v1.end());
intersection = int(vset.size());
printf("the intersection cardinality is %d\n", intersection);
for (iterr=newset.begin(); iterr!=newset.end(); ++iterr){
bool flag = false;
for (it=vset.begin(); it!=vset.end(); ++it)
{
if (*iterr == *it)
{
flag = true;
}
}
if (!flag)
printf("\nThe actual values are %d \n", *iterr);
}
printf("\n");
return *iterr;
}
It returns 3 values as 1, 5, 7.
I want to pass these values into another function. say Convert defined as
void Convert(int position)
but not able to