Mathc initiation/Fichiers h : x 17b03
Installer et compiler ces fichiers dans votre répertoire de travail.
b03.c |
---|
/* ---------------------------------- */
/* Save as : b03.c */
/* ---------------------------------- */
#include "x_ahfile.h"
/* ---------------------------------- */
int main(void)
{
Set A;
int i;
create_SetI(&A);
for(i=1; i<=5; i++) insert_EI(&A,i);
clrscrn();
p_SetI(&A,"A");
i = 2;
if(member_EI(&A,i)) printf(" yes %d is member\n\n\n\n",i);
else printf(" no %d is not member\n\n\n\n",i);
p_SetI(&A,"A");
i = 99;
if(member_EI(&A,i)) printf(" yes %d is member\n\n\n\n",i);
else printf(" no %d is not member\n\n\n\n",i);
stop();
erase_SetI(&A);
return 0;
}
Nous allons tester la commande qui nous permet de vérifier si un élément appartient à l'ensemble.
Exemple de sortie écran :
A = {5,4,3,2,1}
yes 2 is member
A = {5,4,3,2,1}
no 99 is not member
Press return to continue.