#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<YEAR;k++) { s1[0]=s[k]; display(s1,1) break; } if(k>YEAR) printf("您输入的年份有误,请重新输入一个在1990到2012之间的年份"); void display(PLAYERINF s[],int n) { int k; printf("=======================================历届状元秀名单=====================================\n"); printf("年份 姓名 所在球队 毕业学校\n"); printf("-------------------------------------------------------------------------------------------\n"); for(k=0;k<n;k++) { printf("%4d\t%-10s\ts\ts\n",s[k].year,s[k].name,s[k].team,s[k].finishschool); printf("=============================================================================\n"); } }
#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)
- 粉丝: 173
- 资源: 12
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- UnsupportedClassVersionError(解决方案).md
- DOMUpdateError解决办法.md
- VerifyError(解决方案).md
- BlockingIOError.md
- NextTickError解决办法.md
- NSKeyValueCodingError如何解决.md
- ZipException(解决方案).md
- BrokenPipeError.md
- SSRHydrationError解决办法.md
- NSArgumentException如何解决.md
- NSConditionException如何解决.md
- JarException(解决方案).md
- ChildProcessError.md
- NSApplicationError如何解决.md
- DataFormatException(解决方案).md
- SSRRenderingError解决办法.md