当前位置:网站首页>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] 1706 Where does the ball meet
- 【ChaosBlade:节点磁盘填充、杀节点上指定进程、挂起节点上指定进程】
- 外部中断实现按键实验
- Lenovo hybrid cloud Lenovo xcloud: 4 major product lines +it service portal
- Redis fault handling "can't save in background: fork: cannot allocate memory“
- leetcode134. gas station
- OpenGL 3D graphics rendering
- Analysis of using jsonp cross domain vulnerability and XSS vulnerability in honeypot
- Redis summary
- Shell script for changing the current folder and the file date under the folder
猜你喜欢

2022-06-30 Unity核心8——模型导入

Introduction to data fragmentation

Explain Huawei's application market in detail, and gradually reduce 32-bit package applications and strategies in 2022

使用Typora编辑markdown上传CSDN时图片大小调整麻烦问题

LeetCode 715. Range module

Greenplum 6.x version change record common manual

Greenplum 6.x common statements

Category of IP address
![Other 7 features of TCP [sliding window mechanism ▲]](/img/ff/c3f52a7b89804acfd0c4f3b78bc4a0.jpg)
Other 7 features of TCP [sliding window mechanism ▲]

Image segmentation in opencv
随机推荐
Redis fault handling "can't save in background: fork: cannot allocate memory“
模拟卷Leetcode【普通】1706. 球会落何处
Simple use of Xray
[Yugong series] February 2022 U3D full stack class 007 - production and setting skybox resources
let const
指针进阶,字符串函数
ncs成都新电面试经验
Mountaineering team (DFS)
Output all composite numbers between 6 and 1000
What are the advantages of commas in conditional statements- What is the advantage of commas in a conditional statement?
Greenplum6.x搭建_安装
Unityshader introduction essentials personal summary -- Basic chapter (I)
测试人一定要会的技能:selenium的三种等待方式解读,清晰明了
【ChaosBlade:节点 CPU 负载、节点网络延迟、节点网络丢包、节点域名访问异常】
【MySQL】数据库进阶之触发器内容详解
Personal deduction topic classification record
求有符号数的原码、反码和补码【C语言】
[wechat applet: cache operation]
更改当前文件夹及文件夹下文件日期shell脚本
QT charts use (rewrite qchartview to realize some custom functions)