int main() { affiche_tab(tab); affiche_tab2(tab2); //affiche_tab2((int(**)) tab); //affiche_tab((int(*)[4])tab2); return 0; }
// MAIN int main() { int a,b; TABLEAU jean; /*printf("%lu \n", sizeof(TABLEAU));*/ srand(time(NULL)); jean= init_tab(jean); affiche_tab(jean); a = multi( jean); b = min(jean); printf("produit : %d, min : %d \n ", a,b); jean = decalage(jean); affiche_tab(jean); printf("\n"); jean = trirapide(jean, 0, jean.taille); affiche_tab(jean); return 0; }
void histogramme(int tab[], int h[], int taille){ int i,j,c=0; for( i=0; i<taille; i++){ for( j=0; j<taille; j++){ if(tab[i] == tab[j]){ c++; } } h[i] = c; c=0; } affiche_tab(h,taille); }
void crypter_mess(char * mess, cle publique, cle prive) { int * crypted = creer_tab( strlen(mess) ); /*tableau d'entier de taille du message*/ int i=0; while(mess[i] != '\0') { crypted[i] = chiffrer_c( mess[i] , publique.y, publique.x); i++; } affiche_tab(crypted, strlen(mess)); }
int init_tab(int tab[], int taille){ int i,val=0,c=0; for(i=0;i<taille;i++){ printf("Veuillez saisir une valeur "); scanf("%d",&val); if(val<0){ i=taille+1; }else{ tab[i] = val; c++; } } affiche_tab(tab,c); return c; }
/*Ce programme a pour but d'apprendre/comprendre *la gestion des nombres aléatoires et des tableaux *de plus un histogramme est réalisé */ int main() { int tab[DIM_TAB]; int histo[VAL_MAX]; int i; /*Init histogramme*/ for(i = 0 ; i < VAL_MAX ; i++) histo[i] = 0; srand(time(NULL));/*Création de la seed*/ init_alea_tab(tab);/*fonction d'init du tableau aléatoire*/ histogramme(tab,histo);/*création de l'histogramme*/ printf("Premier tableau :\n"); affiche_tab(tab); affiche_histo(histo); return EXIT_SUCCESS; }