第22套
程序填空题
所属年份:2010.9;2011.3;
下列给定程序中,函数fun的功能是:在形参ss所指字符串数组中,查找含有形参substr所指子串的所有字符串,并输出,若没找到则输出相应信息。ss所指字符串数组中共有N个字符串,且串长小于M。程序中库函数strstr(s1,s2)的功能是在s1串中查找s2子串,若没有,函数值为0,若有,函数值为非0。
请在下画线处填入正确的内容并将下画线删除,使程序得出正确的结果。
注意:部分源程序在文件BLANK1.C中。
不得增行或删行,也不得更改程序的结构!
#include <stdio.h>
#include <string.h>
#define N 5
#define M 15
void fun(char (*ss)M], char *substr)
{ int i,find=0;
/**********found**********/
for(i=0; i< __1__ ; i++)
/**********found**********/
if( strstr(ssi], __2__) != NULL )
{ find=1; puts(ssi]); printf("\n"); }
/**********found**********/
if (find==__3__) printf("\nDon't found!\n");
}
main()
{ char xN]M]={"BASIC","C langwage","Java","QBASIC","Access"},strM];
int i;
printf("\nThe original string\n\n");
for(i=0;i<N;i++)puts(xi]); printf("\n");
printf("\nEnter a string for search : "); gets(str);
fun(x,str);
}