Accueil     Soft. MacOSX     Soft. MacOS/PC     PHP     Python     ROMS GBA     TP d'info     DBZ-GT     Martingales     Galeries     Liens     @  

TD1 optimisation

/*
Optimisation TD1 partie prog. 30/01/03
©2003 http://www.Software-DS.com
*/

#include <stdio.h>
#include <math.h>

typedef int ens[100];

void creer_ens(ens E,int n){
int i;
for(i=1;i<=n;i++)
E[i]=0;
}

void ajouter(ens E,int x){
E[x]=1;
}

void retirer(ens E,int x){
E[x]=0;
}

int appartient(ens E,int x){
return (E[x]==1);
}

int ens_vide(ens E,int n){
int i=0;
while ((i<=n) && (E[i]==0))
i++;
return (i>n);
}

void inter_ens(ens E1,ens E2,ens E,int n){
int i;
for(i=1;i<=n;i++)
E[i]=E1[i] && E2[i];
}

void union_ens(ens E1,ens E2,ens E,int n){
int i;
for(i=1;i<=n;i++)
E[i]=E1[i] || E2[i];
}

void main(void){
int i,j,k,tv;
ens E;

/* saisie ds valeurs initiales */
printf("entrer la taille de la matrice\n");
scanf("%d",&i);
creer_ens(E,i);
tv=sqrt(i);

/* définition de la matrice */
do{
printf("vecteur numéro\n");
scanf("%d",&j);
printf("position:\n");
scanf("%d",&k);
if (j>0)
ajouter(E,(j-1)*tv+k);
} while(j>0);

/* ©2003 All Rights Reserved to www.Software-DS.com */
}




Haut de la page - Page précédente - Page générée en 0.00230 sec.
Recherche personnalisée
 

1843945 visiteurs.   ©2001-2023 All Rights Reserved to Software-DS.com
Made with a mac  
Confidentialité