SHOW:
|
|
- or go back to the newest paste.
| 1 | // Verifier la compilation | |
| 2 | #include <stdio.h> | |
| 3 | #include <string.h> // On va utiliser des fcts de cette biblio | |
| 4 | - | void main{
|
| 4 | + | |
| 5 | ||
| 6 | void main(){
| |
| 7 | char chaine[MAX]; | |
| 8 | int i,mots=1; | |
| 9 | ||
| 10 | printf("Entrez une chaine : ");
| |
| 11 | gets(chaine); | |
| 12 | printf("Mot %d : ",mots);
| |
| 13 | for(i=0;i<strlen(chaine);i++){
| |
| 14 | if(chaine[i]==' ') | |
| 15 | {
| |
| 16 | mots++; | |
| 17 | printf("\nMot %d : ",mots);
| |
| 18 | i++; | |
| 19 | } | |
| 20 | printf("%c",chaine[i]);
| |
| 21 | } | |
| 22 | ||
| 23 | system("pause");
| |
| 24 | } |