bouchnina

Untitled

Jul 12th, 2013
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Verifier la compilation
  2. #include <stdio.h>
  3. #include <string.h> // On va utiliser des fcts de cette biblio
  4. #define MAX 1000 // supposons qu une phrase contient 1000 character au maximum
  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. }
Advertisement
Add Comment
Please, Sign In to add comment