题目内容:
编写函数fun(),其功能是:求SS所指字符串中指定字符的个数,并返回此值。例如,若输入字符串“123412132”,输入字符为“1”,则输出3。
注意:部分源程序给出如下。
请勿改动main()函数和其他函数中的任何内容,仅在函数fun()的花括号中填人你编写的若干语句。
试题程序:
#include<stdlib.h>
#include<conio.h>
#include<stdio.h7,
#define M 81
int fun(char*SS,Cbar c)
{
}
void main()
{
char a[M],ch;
system("CLS");
printf("\n Please enter a string:");
gets(a);
printf("\nPleast enter a char:");
ch=getchar();
printf("\nThe number of the char is:%d\n",fun
(a,ch));
}
参考答案:【答案仅供学习,请勿对照自行用药等】
答案解析: