请高手再予指教,谢谢上次的指教
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
char *str1[8],*str2[8],*str3[8];
int SeqSearch(char **p,char *k)
{
int i;
p=str1;
for(i=0;i<7;i++)
if(!strcmp(*(p+i),k))
return (i);
return(-1);
}
int main()
{
char ch[9];
int i,count,nums,k;
printf("how many student your input?\n");
scanf("%d",&nums);
for(i=0;i<nums;i++)
{
count=i+1;
system("cls");
printf(">>1.input your student %d number;\n",count);
scanf("%s",str1[i]);
printf(">>2.input your student %d name;\n",count);
scanf("%s",str2[i]);
printf(">>3.input your student %d score;\n",count);
scanf("%s",str3[i]);
}
printf("input over!\n");
printf("input your search number:\n");
scanf("%s",ch);
k=SeqSearch(str1,ch);
if(k+1)
{
printf("\t number \t name \t score\n");
printf("\t%s\t%s\t%s\n",str1[k],str2[k],str3[k]);
}
else
printf("NOT FIND!\n");
return 0;
}
[此贴子已经被作者于2007-7-8 21:58:21编辑过]