sos 含有struct的函数怎么放到主函数里啊??
#include<stdio.h>#include "string.h"
struct man
{int no;
char name[100];
float y[12];
}pman[100];
int findman(struct man s[],int n,char name[])
{ int k;
for(k=0;k<n;k++)
if(strcmp(s[k].name,name)==0) return k;
return 0;
}
main()
{struct man pman[100]={101,"张三",21,34,107,12,12,12,12,12,12,12,12,12,202,"李四",45,67,108,108,108,108,108,108,108,108,108,108};
char st[12];
int index,i;
printf("请输入要查找人名:");
gets(st);
index=findman(pman,6,st);
if(index) {printf("%d %s",pman[index].no,pman[index].name);for(i=0;i<12;i++) printf("%6.2f",pman[index].y[i]);}
else
printf("%s无此人\n",st);
}
这个函数怎么放的主函数里面啊