#include <stdio.h> /* directive du preprocesseur */
#include <ctype.h>
int transformeMinMaj(char *) ;
void main() {
char car[255], car2[255];
int i,j;
printf("Entrez moi une phrase :\n");
scanf("%s",&car);
for ( i=0, j=0 ; car[j] != '\0' ; j++, i++) {
while (!(((car[j] > 'a')&&(car[j] < 'z'))||((car[j] > 'A')&&(car[j] < 'Z')))) {
j++;
if (car[j] == '\0') break;
}
transformeMinMaj(&car[j]);
car2[i]=car[j];
}
car2[i]='\0';
printf(car2);
printf("\n");
}
int transformeMinMaj(char * c) {
int estalpha;
if (((*c > 'a')&&(*c < 'z'))||((*c > 'A')&&(*c < 'Z')))
estalpha = 1 ;
else
estalpha = 0 ;
if ((*c > 'a')&&(*c < 'z'))
*c = *c + 'A' - 'a';
return estalpha;
} |