Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Verifier la compilation
- #include <stdio.h>
- #include <string.h> // On va utiliser des fcts de cette biblio
- #define MAX 1000 // supposons qu une phrase contient 1000 character au maximum
- void main(){
- char chaine[MAX];
- int i,mots=1;
- printf("Entrez une chaine : ");
- gets(chaine);
- printf("Mot %d : ",mots);
- for(i=0;i<strlen(chaine);i++){
- if(chaine[i]==' ')
- {
- mots++;
- printf("\nMot %d : ",mots);
- i++;
- }
- printf("%c",chaine[i]);
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment