Mathc initiation/Fichiers h : x 17c04
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c04.c |
---|
/* ---------------------------------- */
/* Save as : c04.c */
/* ---------------------------------- */
#include "x_ahfile.h"
/* ---------------------------------- */
int main(void)
{
Set A,B,C,
D,E,
F,G,H;
int i;
create_SetI(&A); create_SetI(&B); create_SetI(&C);
create_SetI(&D); create_SetI(&E);
create_SetI(&F); create_SetI(&G); create_SetI(&H);
for(i=1; i<=7; i++) insert_EI(&A,i);
for(i=4; i<=10; i++) insert_EI(&B,i);
insert_EI(&C,1);insert_EI(&C,5);insert_EI(&C,9);insert_EI(&C,12);
clrscrn();
p_SetI(&A,"A");
p_SetI(&B,"B");
p_SetI(&C,"C");
printf(" D = (B inter C)\n");
inter_SI(&B,&C,&D);
p_SetI(&D,"D");
printf(" E = A mns (B inter C)\n");
mns_SI(&A,&D,&E);
p_SetI(&E,"E");
stop();
clrscrn();
p_SetI(&A,"A");
p_SetI(&B,"B");
p_SetI(&C,"C");
printf(" F = (A mns B)\n");
mns_SI(&A,&B,&F);
p_SetI(&F,"F");
printf(" G = (A mns C)\n");
mns_SI(&A,&C,&G);
p_SetI(&G,"G");
printf(" H = (A mns B) union (A mns C)\n");
union_SI(&F,&G,&H);
p_SetI(&H,"H");
stop();
clrscrn();
printf(" A mns (B inter C) = (A mns B) union (A mns C)\n\n\n");
printf(" E = A mns (B inter C)\n");
p_SetI(&E,"E");
printf(" H = (A mns B) union (A mns C)\n");
p_SetI(&H,"H");
erase_SetI(&H);erase_SetI(&G);erase_SetI(&F);
erase_SetI(&E);erase_SetI(&D);
erase_SetI(&C);erase_SetI(&B);erase_SetI(&A);
stop();
return 0;
}
Nous allons vérifier que :
A mns (B inter C) = (A mns B) union (A mns C)
Exemple de sortie écran :
A mns (B inter C) = (A mns B) union (A mns C)
E = A mns (B inter C)
E = {1,2,3,4,6,7}
H = (A mns B) union (A mns C)
H = {7,6,4,3,2,1}
Press return to continue.