统计字母‘A’出现的次数。
#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') n++;
i++;
}
cout<<"其中'A'的个数是:"<<n<<endl;
return 0;
}