题目内容:
假定输入的字符串中只包含字母和*号。请编写函数proc(),它的功能是:删除字符串中所有的*号。在编写函数时,不得使用C语言中提供的字符串函数。例如,若字符串中的内容为****a*bc*def*g* ***,删除后,字符串中的内容则应当是abedefg。
注意:部分源程序给出如下。
请勿改动main()函数和其他函数中的任何内容,仅在函数proe()的花括号中填入所编写的若干语句。
试题程序:
#include<conio.h>
#include<stdio.h>
void proc(char*a)
{
}
void main()
{
char str[8l];
printf("Enter a string:\n");
gets(str);
proc(str);
printf("The string after deleted:\n");
puts(str);
}
参考答案:
答案解析: