The following program can demonstrates you that how to use the includes() function in the C++ programming language as follows :
Code:
#include <iostream>
#include <algorithm>
using namespace std;
bool myfunction (int p, int q)
{
return p<q;
}
int main ()
{
int cntnr[] = {5,10,15,20,25,30,35,40,45,50};
int cntnt[] = {40,30,20,10};
sort (cntnr,cntnr+10);
sort (cntnt,cntnt+4);
if ( includes(cntnr,cntnr+10,cntnt,cntnt+4) )
cout << "cntnr includes cntnt!" << endl;
if ( includes(cntnr,cntnr+10,cntnt,cntnt+4, myfunction) )
cout << "cntnr includes cntnt!" << endl;
return 0;
}
Output:
Code:
cntnr includes cntnt!
cntnr includes cntnt!
Bookmarks