SHARE
TWEET

Untitled

a guest Dec 3rd, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4.     void ContPalavras(char palavra[], int cont, int n)
  5.     {
  6.         if (n <= 500)
  7.         {
  8.             scanf(" %s", &palavra[n]);
  9.             if (palavra[n] == ' ')
  10.             {
  11.                 ContPalavras(n, ++cont, ++n);
  12.             }
  13.             else if (palavra[n] == '\n')
  14.             {
  15.                 printf("%d\n", cont);
  16.             }
  17.             else
  18.             {
  19.                 ContPalavras(n, cont, ++n);
  20.             }
  21.             return;
  22.         }
  23.         else return;
  24.     }
  25.    
  26.     int main()
  27.     {
  28.         int n;
  29.         char palavra[n];
  30.         ContPalavras(palavra, 1, 0);
  31.         return 0;
  32.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top