填空题

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

while(*str&&*str! =ch)str++;
//************found*************
if(*str==ch)
str[0]=ch;
//************found***********
str[1]=’0’;


void main()

char str[81], ch;
system("CLS");
printf("\nPlease enter a string: ");
gets(str);
printf("\n Please enter the character to search:");
ch=getchar();
proc(str, oh);
printf("\nThe result is%s\n", str);

【参考答案】

(A)错误:void proc(char str, char ch)
正确:void proc(char*st......

(↓↓↓ 点击下方‘点击查看答案’看完整答案、解析 ↓↓↓)