文件名称:查询类代码
文件大小:3KB
文件格式:TXT
更新时间:2016-05-29 14:08:52
信息查询
#include"stdio.h"
#include"stdlib.h"
#define YEAR 23
typedef struct{
int year;
char name[24];
char team[30];
char finishschool[50];
}PLAYERINF;
extern void display(PLAYERINF s[],int n), search(PLAYERINF s[]);
void main()
{
PLAYERINF s[YEAR]={{1990,"柯曼","网队","syracuse"},{1991,"约翰逊","黄蜂","Nevada-las Vegas"},
{1992,"奥尼尔","魔术","Louisiana State"},{1993,"韦伯","魔术","Michigan"},{1994,"罗宾逊","雄鹿","Purdue"},
{1995,"史密斯","勇士","Maryland"},{1996,"艾弗森","76人","Georgetown"},{1997,"邓肯","马刺","Wake Forest"},
{1998,"欧罗伍坎迪","快艇","Brunel"},{1999,"布兰德","公牛","Duke"},{2000,"马丁","网队","Cincinnati"},
{2001,"夸梅-布朗","奇才","Glynn Academy"},{2002,"姚明","火箭","Shanghai"},{2003,"勒布朗-詹姆斯","骑士","St.Mary's HS"},
{2004,"德怀特-霍华德","魔术","Christian Academy"},{2005,"安德鲁-博格特","猛龙","Utah"},{2006,"安德烈-巴格纳尼","欧洲","不详"},
{2007,"格雷格-奥登","开拓者","Ohio State"},{2008,"德里克-罗斯","公牛","Memphis"},{2009,"格里芬","快船","Oklahoma"},
{2010,"约翰-沃尔","奇才","Country"},{2011,"凯瑞-欧文","骑士","Dunk Country"},{2012,"安东尼","黄蜂","肯塔基大学"}};
int ch;
printf("\t\t\t\t功能菜单\n");
printf("===========================================================================\n");
printf("1.显示历届状元秀名单\n");
printf("2.按年份查找状元秀信息\n");
printf("0.退出\n");
scanf("%d",&ch);
while(ch!=0)
{
switch(ch)
{
case 1: display(s,YEAR);break;
case 2: search(s);break;
default: printf("您输入错误,请重新输入!\n");break;
}
system("pause");
system("cls");
printf("功能菜单\n");
printf("================================================================================\n");
printf("1.显示历届状元秀名单\n");
printf("2.按年份查找状元秀信息\n");
printf("0.退出\n");
scanf("%d",&ch);
}
}
void search(PLAYREINF s[])
{
int k,number=0;
PLAYREINT s1[1];
printf("请输入年份:\n");
scanf("%d",&number);
for(k=0;k