#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
//輸入字符串,並對其大小寫和字符進行統計輸出
//經分析,除了英文,其他都是字符。
void main(void)
{
char Strs[100];
int BCount=0,SCount=0,CharChout=0,i=0;
printf("請輸入一個字符串:\r\n");
gets(Strs);
for (i = 0; i < 100; i++)
{
if(Strs[i]=='\0')
{
break;
}
//如果是大寫
if(Strs[i]>='A'&&Strs[i]<='Z')
{
BCount++;
}
else if(Strs[i]>='a'&&Strs[i]<='z')
{
SCount++;
}
else
{
CharChout++;
}
}
printf("您輸入的字符串中:大寫%d個,小寫%d個,字符%d個!\r\n",BCount,SCount,CharChout);
system("pause");
}