编写一个C程序,使用while循环计算句子的平均单词长度

2023年 8月 28日 21.5k 0

START
Step 1: declare character, int and double variables
Step 2: Enter any statement
Step 3: while loop
Check condition stmt[i]=getchar()) != '

'
True then enter into loop
Increment I and call the function at step 5
Step 4: Print the average length return by function
From step 5
Step 5: called function calculatewordlength
i. declare and initialize
charcount=0 and wordcount=1
ii. while loop
check condition (*stmt != '

')
if it trues enter into loop
1. if(*stmt != ' ')
2. charcount++;
3. else if(*stmt == ' ')
4. wordcount++;
5. stmt++;
iii. return (double)charcount/wordcount;
STOP

相关文章

如何删除WordPress中的所有评论
检查WordPress服务器磁盘使用情况的7种简便方法(查找大文件和数据)
如何更改WordPress常量FS_METHOD
如何为区块编辑器、Elementor等构建WordPress文章模板
如何彻底地删除WordPress主题及相关内容
如何使用WordPress搭建一个内网

发布评论