int main(int argc, char**argv) { while (--argc) Palindrome(argv[argc]); return 0; }
void main() { Palindrome("bob"); }mais alors il faut recompiler à chaque test.
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question#include <stdio.h> #include <string.h> #include<conio.h> #include<stdlib.h> void Creer(FILE **fp) { char f[30]; printf("Fichier:"); scanf("%s",f); *fp=fopen(f,"r") ; if (*fp==NULL ) {printf("probleme ouverture!!!");exit(EXIT_FAILURE); } } int palindrome (char *s) {int i,j,l; l=strlen(s); for(i=0,j=l-1;i<j;i++,j--) if(s[i]!=s[j]) return 0; return 1; } int main() { FILE *fp=NULL; char *ch,*s; int L,p;char c; Creer(&fp) ; L=0; while(fgets(ch,100,fp)!=NULL) { L=L+1; p=palindrome(ch); /* Affichage du résultat */ if(p==1) { printf("La chaine %s est un palindrome ,elle est dans la ligne %d",ch, L);getch();} else { printf("\n");} } fclose(fp); return(0); }