COMPILER ERROR: "Sort" was not declared in this scope

gimme the solution pls....
#include<iostream>
#include<vector>
#include<stdlib.h>
using namespace std;
bool myfunction (int i,int j) { return (i<j); }
struct myclass
{
bool operator() (int i,int j) { return (i<j);}
} myobject;
int main()
{
long int a,b,m,i,j,l=0,n=0;
cin>>m;
vector<int> c(m);
for(i=0;i<m;i++)
{
std::cin>>a>>b;
if(a>=b)
{c.push_back(b);}
else
{c.push_back(a);}
}
sort(c.begin(),c.end(),myobject);
i=0;
while(i<m)
{
if(c[i]<n+1)
{
i++;
}
else
{
l++;
n++;
i++;
}
}
cout<<"\n"<<l<<"\n";
system("PAUSE");
return 0;
}
You forgot to include <algorithm>.
uh! that was a stupid mistake!!! thanks mate!
Topic archived. No new replies allowed.