当前位置:网站首页>Count the number of words C language
Count the number of words C language
2022-07-07 08:57:00 【Please Sit Down】
subject : Enter a line of characters , Statistics of which English words The number of . Space between words .
#define N 50
int main(void){
char str[N];
printf(" Please enter :");
gets(str);
char *p;
p = str;
int sum=0;
while(*p){
if(*p>='a'&&*p<='z' || *p>='A'&&*p<='Z'){
sum++;
}
p++;
}
printf(" Altogether %d Word !",sum);
return 0;
}subject : Enter a line of characters , Statistics of which word The number of . Space between words .
#define N 50
int main(void){
char str[N];
printf(" Please enter :");
gets(str);
char *p;
p = str;
int sum=0,flag=0;
while(*p){
if(*p == ' '){
flag = 0;
}else if(flag == 0){
sum++;
flag = 1;
}
p++;
}
printf(" Altogether %d Word !",sum);
return 0;
}边栏推荐
- leetcode135. Distribute candy
- Common operating commands of Linux
- 数字三角形模型 AcWing 1027. 方格取数
- UnityShader入门精要个人总结--基础篇(一)
- 硬核分享:硬件工程师常用工具包
- LeetCode 736. Lisp 语法解析
- Panel display technology: LCD and OLED
- 使用Typora编辑markdown上传CSDN时图片大小调整麻烦问题
- Tronapi wave field interface - source code without encryption - can be opened twice - interface document attached - package based on thinkphp5 - detailed guidance of the author - July 6, 2022 - Novice
- [Yugong series] February 2022 U3D full stack class 005 unity engine view
猜你喜欢

数字三角形模型 AcWing 1027. 方格取数

面试题:高速PCB一般布局、布线原则

Troublesome problem of image resizing when using typora to edit markdown to upload CSDN

硬核分享:硬件工程师常用工具包

Digital triangle model acwing 275 Pass a note

Category of IP address

最长上升子序列模型 AcWing 1017. 怪盗基德的滑翔翼

Greenplum 6.x reinitialization

Mountaineering team (DFS)

How to realize sliding operation component in fast application
随机推荐
Troublesome problem of image resizing when using typora to edit markdown to upload CSDN
模拟卷Leetcode【普通】1557. 可以到达所有点的最少点数目
Test pits - what test points should be paid attention to when adding fields to existing interfaces (or database tables)?
Isomorphic C language
Routing information protocol rip
Common operating commands of Linux
What are the advantages of commas in conditional statements- What is the advantage of commas in a conditional statement?
Frequently Asked Coding Problems
Simulation volume leetcode [general] 1705 The maximum number of apples to eat
Unity Shader入门精要初级篇(一)-- 基础光照笔记
Count sort (diagram)
年薪50w阿裏P8親自下場,教你如何從測試進階
Analysis of abnormal channel number information before and after AGC re signature service
Gson转换实体类为json时报declares multiple JSON fields named
Redis summary
模拟卷Leetcode【普通】1567. 乘积为正数的最长子数组长度
PPT模板、素材下载网站(纯干货,建议收藏)
Digital triangle model acwing 1027 Grid access
LeetCode 715. Range module
Mock. JS usage details