您的位置:首页 > 其它

统计字符串中大写字母的个数

2015-09-24 18:31 337 查看
#include "stdio.h"
#include "malloc.h"

int numberofUpper(char*ch)
{
char*p;
int count=0;
p=ch;
if(p==NULL)
return 0;
while(*p!='\0')
{
while(*p>='0'&&*p<='9')
{
count++;
}
p++;
}
return count;
}
int main()
{
char*str;
int num;
str=(char*)malloc(100);
gets(str);
num=numberofUpper(str);
printf("%d\n",num);
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: