当前位置:网站首页>函数:计算字符串中大写字母的个数
函数:计算字符串中大写字母的个数
2022-07-06 09:24:00 【|光|】
要求
编一个名为countc函数,要求如下:
形式参数:array 存放字符串的字符型数组名
功能: 统计array数组中大写字母的数目
返回值: 字符串中大写字母的数目
代码
#include<string.h>
/* *在该函数中实现对字符串中的大写字母的统计 */
int countc(char a[])
{
int sum=0;
int i;
for(i=0;i<100;i++)
{
if(a[i]=='\0')
break;
else if(a[i]>='A'&&a[i]<='Z')
sum = sum+1;
}
return sum;
}
测试
测试输入
dfaDASFA4rdfsFDGSdfsgh
输出
大写字母个数为9
边栏推荐
- Statistics 8th Edition Jia Junping Chapter 10 summary of knowledge points of analysis of variance and answers to exercises after class
- . Net6: develop modern 3D industrial software based on WPF (2)
- {1,2,3,2,5}查重问题
- MSF generate payload Encyclopedia
- Ucos-iii learning records (11) - task management
- Detailed explanation of network foundation
- Intranet information collection of Intranet penetration (4)
- The difference between layer 3 switch and router
- XSS unexpected event
- Attack and defense world misc practice area (GIF lift table ext3)
猜你喜欢

Intel oneapi - opening a new era of heterogeneity

JVM memory model concept

“Hello IC World”

Hackmyvm target series (7) -tron

内网渗透之内网信息收集(五)

Only 40% of the articles are original? Here comes the modification method

Binary search tree concept

Solutions to common problems in database development such as MySQL

DVWA (5th week)

Hcip -- MPLS experiment
随机推荐
{1,2,3,2,5}查重问题
Statistics 8th Edition Jia Junping Chapter 7 Summary of knowledge points and answers to exercises after class
Database monitoring SQL execution
《统计学》第八版贾俊平第三章课后习题及答案总结
JDBC看这篇就够了
Proceedingjoinpoint API use
我的第一篇博客
High concurrency programming series: 6 steps of JVM performance tuning and detailed explanation of key tuning parameters
Xray and Burp linked Mining
【指针】查找最大的字符串
搭建域环境(win)
Intranet information collection of Intranet penetration (I)
网络层—简单的arp断网
servlet中 servlet context与 session与 request三个对象的常用方法和存放数据的作用域。
xray与burp联动 挖掘
【指针】统计一字符串在另一个字符串中出现的次数
Binary search tree concept
The United States has repeatedly revealed that the yield of interest rate hiked treasury bonds continued to rise
内网渗透之内网信息收集(一)
Always of SystemVerilog usage_ comb 、always_ iff