Vérifier si un ‘set’ est un sous-ensemble d’un autre

Author:

 set
{filelink=15235}

#include 
#include 
#include 
using namespace std;

int main() {
  set my_set, my_set2;

  for(int x=1; x<9; x++)
	  my_set.insert(x);

  for(x=1; x<3; x++)
	  my_set2.insert(x);

  if (includes(my_set.begin(), my_set.end(),my_set2.begin(), my_set2.end())) {
    cout << "my_set2 est un sous ensemble de my_setn";
  }
  if (includes(my_set2.begin(), my_set2.end(), my_set.begin(), my_set.end())) {
    cout << "my_set est un sous ensemble de my_set2n";
  }

  return (0);
}

Leave a Reply

Your email address will not be published. Required fields are marked *