统计字符串中字母的个数
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
char str[50];
int i=0,n=0;
cout<<"输出字符串:"<<endl;
gets(str);
while (str[i]!='\0')
{
if (str[i]>='A'&&str[i]<='Z')
{
n++;
i++;
}
else if (str[i]>='a'&&str[i]<='z')
{
n++;
i++;
}
}
cout<<"其中字母的个数是:"<<n<<endl;
return 0;
}