用c语言编程:输入一段英文句子,计算该句子的单词个数
答案:1 悬赏:20
解决时间 2021-01-12 23:31
- 提问者网友:愿为果
- 2021-01-12 09:08
用c语言编程:输入一段英文句子,计算该句子的单词个数
最佳答案
- 二级知识专家网友:几近狂妄
- 2021-01-12 09:51
#include "stdio.h"
main()
{
char *s;
int cnt = 0;
printf("please enter the sentence\n");
gets(s);
while(*s)
{
if(*s==' ') cnt++;
s++;
}
printf("the sectence have %d word\n",cnt+1);
}追问cnt *s是什么意思啊?追答字符指针啊,指向你输入的字符串
main()
{
char *s;
int cnt = 0;
printf("please enter the sentence\n");
gets(s);
while(*s)
{
if(*s==' ') cnt++;
s++;
}
printf("the sectence have %d word\n",cnt+1);
}追问cnt *s是什么意思啊?追答字符指针啊,指向你输入的字符串
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息!
大家都在看
推荐信息