当前位置:网站首页>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;
}
边栏推荐
- How to add a mask of a target in a picture
- 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
- Category of IP address
- Output all composite numbers between 6 and 1000
- Greenplum 6.x version change record common manual
- 【ChaosBlade:节点 CPU 负载、节点网络延迟、节点网络丢包、节点域名访问异常】
- 阿里p8推荐,测试覆盖率工具—Jacoco,实用性极佳
- Speaking of a software entrepreneurship project, is there anyone willing to invest?
- Greenplum6.x常用语句
- MAC OSX php dyld: Library not loaded: /usr/local/xxxx. dylib
猜你喜欢
Other 7 features of TCP [sliding window mechanism ▲]
数字三角形模型 AcWing 275. 传纸条
【Istio Network CRD VirtualService、Envoyfilter】
Data analysis methodology and previous experience summary 2 [notes dry goods]
Led analog and digital dimming
UnityShader入门精要个人总结--基础篇(一)
Introduction to data fragmentation
面试题:高速PCB一般布局、布线原则
[Yugong series] February 2022 U3D full stack class 007 - production and setting skybox resources
Greenplum 6.x common statements
随机推荐
[MySQL] detailed explanation of trigger content of database advanced
Three series of BOM elements
Gson转换实体类为json时报declares multiple JSON fields named
Greenplum 6.x reinitialization
Greenplum6.x搭建_环境配置
H3C VXLAN配置
【istio简介、架构、组件】
【踩坑】nacos注册一直连接localhost:8848,no available server
Simulation volume leetcode [general] 1609 Parity tree
Alibaba P8 teaches you how to realize multithreading in automated testing? Hurry up and stop
The longest ascending subsequence model acwing 1017 Strange thief Kidd's glider
更改当前文件夹及文件夹下文件日期shell脚本
OpenGL三维图形绘制
With an annual salary of 50W, Alibaba P8 will come out in person to teach you how to advance from testing
Several methods of calculating the average value of two numbers
Platformization, a fulcrum of strong chain complementing chain
Greenplum 6.x build_ install
面板显示技术:LCD与OLED
Simulation volume leetcode [general] 1706 Where does the ball meet
Greenplum 6.x common statements