Skip to content

Instantly share code, notes, and snippets.

@savaryna
Created December 4, 2014 14:17
Show Gist options
  • Save savaryna/81e684577cdf96b42223 to your computer and use it in GitHub Desktop.
Save savaryna/81e684577cdf96b42223 to your computer and use it in GitHub Desktop.
#include <conio.h>
#include <stdio.h>
#include <string.h>
// Numara cite cuvinte sunt in sir
void main()
{
int c=0;
char str[1024];
char* p;
printf("\nIntroduceti un sir de caractere si apoi apasati Enter\n");
gets(str);
p=strtok(str," ");
while (p!=NULL)
{
p=strtok(NULL, " ");
c++;
}
printf("\nNumarul de cuvinte este: %d",c);
getch();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment