当前位置:网站首页>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;
}
边栏推荐
- Simulation volume leetcode [general] 1567 Length of the longest subarray whose product is a positive number
- Implement custom memory allocator
- LeetCode 736. Lisp 语法解析
- Platformization, a fulcrum of strong chain complementing chain
- 年薪50w阿里P8亲自下场,教你如何从测试进阶
- Gson转换实体类为json时报declares multiple JSON fields named
- [Nanjing University] - [software analysis] course learning notes (I) -introduction
- 阿里p8手把手教你,自动化测试应该如何实现多线程?赶紧码住
- Unity shader beginner's Essentials (I) -- basic lighting notes
- Several methods of calculating the average value of two numbers
猜你喜欢
[Nanjing University] - [software analysis] course learning notes (I) -introduction
Nanjing commercial housing sales enabled electronic contracts, and Junzi sign assisted in the online signing and filing of housing transactions
[Yugong series] February 2022 U3D full stack class 006 unity toolbar
串口实验——简单数据收发
Output a spiral matrix C language
Digital triangle model acwing 275 Pass a note
Platformization, a fulcrum of strong chain complementing chain
【istio简介、架构、组件】
阿里p8推荐,测试覆盖率工具—Jacoco,实用性极佳
Panel display technology: LCD and OLED
随机推荐
Several common database connection methods
2022-06-30 unity core 8 - model import
OpenGL frame buffer
RuntimeError: Calculated padded input size per channel: (1 x 1). Kernel size: (5 x 5). Kernel size c
Markdown editor Use of MD plug-in
Problems encountered in the use of go micro
Simulation volume leetcode [general] 1706 Where does the ball meet
Synchronized underlying principle, volatile keyword analysis
NCS Chengdu Xindian interview experience
H3C VXLAN配置
模拟卷Leetcode【普通】1706. 球会落何处
阿里p8推荐,测试覆盖率工具—Jacoco,实用性极佳
Nanjing commercial housing sales enabled electronic contracts, and Junzi sign assisted in the online signing and filing of housing transactions
数字三角形模型 AcWing 275. 传纸条
let const
Gson转换实体类为json时报declares multiple JSON fields named
[step on the pit] Nacos registration has been connected to localhost:8848, no available server
Three usage scenarios of annotation @configurationproperties
Count sort (diagram)
使用Typora编辑markdown上传CSDN时图片大小调整麻烦问题