//-----------------------------------------------------
// C++APP,统计一段话中英语单词个数!
//------------------------------------------------------
#include "iostream.h"
#include "stdio.h" //包含gets函数
int main()
{
char string[10000];
int i;
int num = 0; /* 统计单词个数 */
bool word; /* 判定是否为单词 */
word = false;
char c;
cout<<"Input sentence,Please."<
gets(string);
for (i = 0; (c = string[i]) != '\0'; i++) //以回车'ENTER'作为结束标志!
{
if (c == ' ')
word = 0;
else
if (word == false)
{
word = true;
num++;
}
}
cout<<"The sum of words is:"<
return 0;
}