#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
char c, arr[50];
int i, num = 1, word = 1;
printf("please input words:\n");
gets(arr);
for (i = 0; (c = arr[i]) != '\0'; i++)
if (c == ' ') num = 0;
else if (num == 0)
{
word++;
num = 1;
}
printf("words=%d\n", word);
return 0;
}
标签:arr,判断,word,int,单词,num,words,printf,输入 From: https://blog.51cto.com/u_16073189/6317470