Mathc initiation/Fichiers h : x 17c11
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c11.c |
---|
/* ---------------------------------- */
/* Save as : c11.c */
/* ---------------------------------- */
#include "x_ahfile.h"
/* ---------------------------------- */
int main(void)
{
Set A,B,S,
AinterB,C_AinterB,
C_A,C_B,C_AunionC_B;
int i;
create_SetI(&A);
create_SetI(&B);
create_SetI(&S);
create_SetI(&AinterB);
create_SetI(&C_AinterB);
create_SetI(&C_A);
create_SetI(&C_B);
create_SetI(&C_AunionC_B);
for(i=5; i<=10; i++) insert_EI(&A,i);
for(i=7; i<=13; i++) insert_EI(&B,i);
for(i=1; i<=15; i++) insert_EI(&S,i);
clrscrn();
p_SetI(&A,"A");
p_SetI(&B,"B");
p_SetI(&S,"S");
printf("\n (A inter B)^c\n");
inter_SI(&A,&B,&AinterB);
compl_SI(&AinterB,&S,&C_AinterB);
p_SetI(&C_AinterB,"(A inter B)^c");
printf("\n A^c union B^c\n");
compl_SI(&A,&S,&C_A);
compl_SI(&B,&S,&C_B);
union_SI(&C_A,&C_B,&C_AunionC_B);
p_SetI(&C_AunionC_B,"A^c union B^c");
if(equal_SI(&C_AinterB,&C_AunionC_B))
printf("\n (A inter B)^c = A^c union B^c\n\n");
else
printf("\n (A inter B)^c != A^c union B^c\n\n");
erase_SetI(&A);
erase_SetI(&B);
erase_SetI(&S);
erase_SetI(&AinterB);
erase_SetI(&C_AinterB);
erase_SetI(&C_A);
erase_SetI(&C_B);
erase_SetI(&C_AunionC_B);
stop();
return 0;
}
Nous allons vérifier que :
(A inter B)^c = A^c union B^c
Exemple de sortie écran :
A = {10,9,8,7,6,5}
B = {13,12,11,10,9,8,7}
S = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1}
(A inter B)^c
(A inter B)^c = {1,2,3,4,5,6,11,12,13,14,15}
A^c union B^c
A^c union B^c = {6,5,15,14,13,12,11,4,3,2,1}
(A inter B)^c = A^c union B^c
Press return to continue.