Bonjour
J'essaie de converir un texte en minuscul s'il est en majuscul, et vice versa, mais mon code ne convertit qu'en un seul sens, en fonction si c'est toupper ou tolower qui vient en premier.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #include <stdio.h> #include <stdlib.h> main(){ char text[80]; char texti[80]; int i, cpt; for(i=0; (text[i]=getchar())!='\n'; i++) cpt=i; for(i=0; i<=cpt; i++) if(tolower(text[i])) putchar(toupper(text[i])); else if (toupper(text[i])) putchar(tolower(text[i])); system("PAUSE"); }
Partager