#include
#define N 10
void main()
{
char ch;
char str[N] = {0};
int i = 0, j = 0;
printf("请输入字符串 : ");
gets(str);
printf("请输入要查找的字符: ");
scanf("%c", &ch);
for (i; i < strlen(str); i++)
{
if (str[i] == ch)
{
j++;
}
}
printf("字符%c出现的个数为 : %d \n ",ch, j);
}
懂不?