当前位置:网站首页>函数:计算字符串中大写字母的个数
函数:计算字符串中大写字母的个数
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 6 Summary of knowledge points of statistics and sampling distribution and answers to exercises after class
- Statistics, 8th Edition, Jia Junping, Chapter VIII, summary of knowledge points of hypothesis test and answers to exercises after class
- DVWA (5th week)
- Wu Enda's latest interview! Data centric reasons
- 小程序web抓包-fiddler
- WEB漏洞-文件操作之文件包含漏洞
- Detailed explanation of network foundation routing
- Statistics 8th Edition Jia Junping Chapter 7 Summary of knowledge points and answers to exercises after class
- The most popular colloquial system explains the base of numbers
- [issue 18] share a Netease go experience
猜你喜欢
四元数---基本概念(转载)
网络基础之路由详解
New version of postman flows [introductory teaching chapter 01 send request]
Hcip -- MPLS experiment
线程的实现方式总结
《统计学》第八版贾俊平第十一章一元线性回归知识点总结及课后习题答案
搭建域环境(win)
High concurrency programming series: 6 steps of JVM performance tuning and detailed explanation of key tuning parameters
Harmonyos JS demo application development
JDBC看这篇就够了
随机推荐
SystemVerilog discusses loop loop structure and built-in loop variable I
DVWA (5th week)
Lintcode logo queries the two nearest saplings
Statistics, 8th Edition, Jia Junping, Chapter 6 Summary of knowledge points of statistics and sampling distribution and answers to exercises after class
MSF generate payload Encyclopedia
On the idea of vulnerability discovery
Mathematical modeling idea of 2022 central China Cup
《统计学》第八版贾俊平第一章课后习题及答案总结
《统计学》第八版贾俊平第十二章多元线性回归知识点总结及课后习题答案
Intranet information collection of Intranet penetration (I)
网络层—简单的arp断网
New version of postman flows [introductory teaching chapter 01 send request]
flask实现强制登陆
{1,2,3,2,5}查重问题
【指针】查找最大的字符串
内网渗透之内网信息收集(五)
《英特尔 oneAPI—打开异构新纪元》
Attack and defense world misc practice area (simplerar, base64stego, no matter how high your Kung Fu is, you are afraid of kitchen knives)
Wei Shen of Peking University revealed the current situation: his class is not very good, and there are only 5 or 6 middle-term students left after leaving class
Data mining - a discussion on sample imbalance in classification problems