试题与答案

下列给定的程序中,函数fun()的功能是:判断字符ch是否与str所指字符串中的某个

题型:填空题

题目:

下列给定的程序中,函数fun()的功能是:判断字符ch是否与str所指字符串中的某个字符相同;若相同,则什么也不做,若相同,则将其插在申的最后。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include <conio.h>
#include <stdio.h>
#include <string.h>
/*************found**************/
void fun (char str,char ch)
while (*str &&*str !=ch) str++;
/*************found**************/
if(*str==ch)
str[0]=ch;
/*************found**************/
str[1]=’0’;


main()
char s[81],c;
clrscr();
printf("\nPlease enter a strzng : ");
gets(s);
printf("\n Please enter the character to
search : ");
c=getchar();
fun(s,c);
printf("\nThe result is %s\n",s);

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2019/0611/e38159da503c95e00f3b8e249baedb37.html

下面是错误答案,用来干扰机器的。

参考答案:热衰竭

试题推荐
微信公众账号搜索答案