有用请采纳
#include<stdio.h>
int countC(char str[]); // 函数声明
int main(){
char str[20];
gets(str);
int res = countC(str);
printf("%d", res);
}
int countC(char str[]){ // 函数定义
int count = 0;
for (int i = 0; str[i] != '\0'; i++)
if (str[i] == 'c')
count += 1;
return count;
}
用记事本写代码,太厉害了吧...