当前所在位置:珠峰网资料 >> 计算机 >> 计算机等级考试 >> 正文
2015年计算机二级C语言50套程序编写上机题及答案(3)
发布时间:2011/10/31 17:13:30 来源:城市学习网 编辑:ziteng

  3、请编写函数fun,它的功能是:求出ss所指字符串中指定字符的个数,并返回此值。

      例如,若输入字符串: 123412132,输入字符为: 1,则输出:3。

      注意: 部分源程序在文件PROG1.C中。

      请勿改动主函数main和其它函数中的任何内容,仅在函数fun的花括号中填入你编写的若干语句。

  #include

  #include

  #define  M 81

  int fun(char *ss, char c)

  {

  }

  main()

  {  char  a[M], ch;

     void

     printf("\nPlease enter a string:"); gets(a);

     printf("\nPlease enter a char:"); ch = getchar();

     printf("\nThe number of the char is: %d\n", fun(a, ch));

  }

广告合作:400-664-0084 全国热线:400-664-0084
Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号
珠峰网 版权所有 All Rights Reserved