Goldberg
Nouveau membre
:\C\bin>gcc --std=c99 -Wall -W --pedantic maite.c
maite.c: In function `tab':
maite.c:35: warning: type of `n' defaults to `int'
maite.c: In function `tri':
maite.c:46: warning: type of `n' defaults to `int'
----------------------------------------------------------------
[cpp]#include <stdio.h>
/* ------------------------------------------------------------------------ */
void PrintDescription(void)
/* Affiche des informations concernant le crible d'Eratosthene sur la */
/* sortie standard. */
{
printf( "------------------------------------------------------\n");
printf( "Crible d'Eratosthene\n");
printf( "------------------------------------------------------\n");
printf( "Cette methode permet d'obtenir la liste des nombres\n");
printf( "premiers inferieurs a n.\n");
printf( "------------------------------------------------------\n");
}
void tab
{ int i=0,a=2;
int B[n];
printf("\n");
printf("premier tableau, ts les nombres\n");
while (a<=n) {B=a; ;printf( "%d ", B); a=a+1;i=i+1;};
}
void tri
{ int b, cpt=0,a;
printf("\n");
printf("\n");
int B[n];
printf("deuxieme tableau, rien que les nombres premiers\n");
for(a=2;a<=n;a++) {B[a]=a;}
for (a=2;a<=n;a++)
{if (B[a]!=0) {for(b=a+1;b<=n;b++)
{if ((B!=0) & (B%a==0)) {B=0;}}
}
}
for (a=2;a<=n;a++) {if (B[a]>0) {cpt++;printf("%d ", B[a]);}
;}
printf("\n");
if ( cpt<=1) {printf("\n%d nombre premier au total\n", cpt);};
if ( cpt>1) {printf("\n%d nombres premiers au total\n", cpt);};
}
int main()
{int choix, n;
PrintDescription();
while (1)
{printf("\n1) Crible\n2) Quit\n");
printf("\n");
scanf("%d", &choix);
switch(choix) { case 1 : printf("\nchoix n = ?\n ");
printf("\n");
scanf("%d", &n);
if (n<2) {printf("\n");printf("He oh quel est l'interet de chercher les nombres premiers inferieurs a 2?\n");
break;};
tab, tri;break;
default : printf("\n");printf("Au revoir\n");return 0;
}
}
}[/cpp]
qq'un aurait une idée?
maite.c: In function `tab':
maite.c:35: warning: type of `n' defaults to `int'
maite.c: In function `tri':
maite.c:46: warning: type of `n' defaults to `int'
----------------------------------------------------------------
[cpp]#include <stdio.h>
/* ------------------------------------------------------------------------ */
void PrintDescription(void)
/* Affiche des informations concernant le crible d'Eratosthene sur la */
/* sortie standard. */
{
printf( "------------------------------------------------------\n");
printf( "Crible d'Eratosthene\n");
printf( "------------------------------------------------------\n");
printf( "Cette methode permet d'obtenir la liste des nombres\n");
printf( "premiers inferieurs a n.\n");
printf( "------------------------------------------------------\n");
}
void tab
{ int i=0,a=2;
int B[n];
printf("\n");
printf("premier tableau, ts les nombres\n");
while (a<=n) {B=a; ;printf( "%d ", B); a=a+1;i=i+1;};
}
void tri
{ int b, cpt=0,a;
printf("\n");
printf("\n");
int B[n];
printf("deuxieme tableau, rien que les nombres premiers\n");
for(a=2;a<=n;a++) {B[a]=a;}
for (a=2;a<=n;a++)
{if (B[a]!=0) {for(b=a+1;b<=n;b++)
{if ((B!=0) & (B%a==0)) {B=0;}}
}
}
for (a=2;a<=n;a++) {if (B[a]>0) {cpt++;printf("%d ", B[a]);}
;}
printf("\n");
if ( cpt<=1) {printf("\n%d nombre premier au total\n", cpt);};
if ( cpt>1) {printf("\n%d nombres premiers au total\n", cpt);};
}
int main()
{int choix, n;
PrintDescription();
while (1)
{printf("\n1) Crible\n2) Quit\n");
printf("\n");
scanf("%d", &choix);
switch(choix) { case 1 : printf("\nchoix n = ?\n ");
printf("\n");
scanf("%d", &n);
if (n<2) {printf("\n");printf("He oh quel est l'interet de chercher les nombres premiers inferieurs a 2?\n");
break;};
tab, tri;break;
default : printf("\n");printf("Au revoir\n");return 0;
}
}
}[/cpp]
qq'un aurait une idée?