简单小课设
来源:互联网 发布:spark sql seq 编辑:程序博客网 时间:2024/06/05 00:32
#include<stdio.h>#include<stdlib.h>#include<string.h>#define N 100#define AFC 0//亚冠#define CSL 1//中超#define FM 2//友谊赛#define TMI 3//队员信息typedef struct Guoan{int Kind; //比赛类型char Date[20]; //比赛时间char OpenBallDate[10]; //开球时间char AtHome[20]; //主场队名char ByAway[20]; //客场队名 char Sorce[20]; //比分}Guoan;typedef struct Player{ char Name[20]; //姓名 char Birthday[20]; //生日 char Location[20]; //出生地 char Position[20]; //位置}Player; int InitInfo(Guoan *g);int InitPlayer(Player *p);void Show(Guoan*g,int n,int count){ int i;printf(" %-14s%-14s%-14s%-14s\n","时间","主场","客场","比分");for(i=0;i<count;i++){if(n==1 && g[i].Kind==0)printf("%-14s%-14s%-14s%-14s\n",g[i].Date,g[i].AtHome,g[i].ByAway,g[i].Sorce);else if(n==2 && g[i].Kind==1) printf("%-14s%-14s%-14s%-14s\n",g[i].Date,g[i].AtHome,g[i].ByAway,g[i].Sorce);else if(n==3&& g[i].Kind==2) printf("%-14s%-14s%-14s%-14s\n",g[i].Date,g[i].AtHome,g[i].ByAway,g[i].Sorce);}}void FindData(Guoan*g,char *data,int count){ int i,flag=1; printf(" %-14s%-14s%-14s%-14s\n","时间","主场","客场","比分"); for(i=0;i<count;i++) { if(strcmp(g[i].Date,data)==0) { printf("%-14s%-14s%-14s%-14s\n",g[i].Date,g[i].AtHome,g[i].ByAway,g[i].Sorce); flag=0; } } if(flag) printf("该时间没有比赛.\n");}void ShowPlayer(Player* p,int count){int i;printf(" %-14s%-20s%-10s%-14s\n","姓名","生日","出生地","位置");for(i=0;i<count;i++){printf("%-14s%-20s%-10s%-14s\n",p[i].Name,p[i].Birthday,p[i].Location,p[i].Position);}}void Menu(Guoan *g,Player *p,int count,int countplayer){int n;char data[20];printf("\t\t\t国安2013赛季赛况!\n");printf("1.亚冠 2.中超 3.友谊赛 4.球员简介 5.时间查询\n");printf("请选择(1-5):");scanf("%d",&n);getchar();switch(n){case 1:Show(g,n,count);break;case 2:Show(g,n,count);break; case 3:Show(g,n,count);break;case 4:ShowPlayer(p,countplayer);break;case 5:printf("请输入时间:");gets(data);FindData(g,data,count);break;}system("pause");system("cls");}void main(){ int count,countplayer; Guoan guoan[N]; Player player[N]; count=InitInfo(guoan); countplayer=InitPlayer(player); while(1) { Menu(guoan,player,count,countplayer); }}int InitInfo(Guoan *g){ int i; int a[]={0,1,0,1,1,0,1,0,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,2}; char data[][20]={"2月27日","3月8日","3月13日","3月16日","3月29日","4月2日","4月5日","4月10日","4月14日","4月19日","4月23日","4月27日","4月30日","5月5日","5月11日","5月18日","5月25日","6月1日","6月22日","6月26日","6月29日","7月7日","7月14日","7月31日","8月4日","8月10日","8月10日"}; char str[][30]={"北京国安","浦项制铁","武汉卓尔","本尤德科","江苏舜天","大连阿尔滨","广岛三箭","广州富力","上海申花","杭州绿城","青岛中能","上海上港","广州恒大","上海申鑫","贵州茅台","长春亚泰","天津泰达","辽宁宏运","山东鲁能","武汉卓尔","江苏舜天"}; char score[][20]={"1:2","2:1","1:1"}; int c[]={1,0,0,2,0,3,4,0,0,0,0,5,6,0,7,0,8,0,9,0,10,11,0,12,0,13,13}; int d[]={0,11,6,0,12,0,0,3,13,14,1,0,0,15,0,16,0,17,0,18,0,0,19,0,20,0,0}; int e[]={0,1,2,0,1,2,0,0,1,2,1,1,2,0,0,0,1,2,2,1,0,0,1,2,1,1}; for(i=0;i<sizeof(a)/sizeof(*a);i++) { g[i].Kind=a[i]; strcpy(g[i].Date,data[i]); strcpy(g[i].AtHome,str[c[i]]); strcpy(g[i].ByAway,str[d[i]]); strcpy(g[i].Sorce,score[e[i]]); } return sizeof(a)/sizeof(*a);}int InitPlayer(Player *p){ int i; char name[][20]={"张思鹏","侯森","杨智","柏小磊","张俊哲","于洋","周挺","徐云龙","杨运","郎征","雷腾龙","孟洋","弗朗索瓦","马季奇","徐亮","王长庆","马努","张稀哲","张晓彬","徐武","张辛昕","祝一帆","姜涛","矫喆","王皓","张健","李提香","朴成","谭天澄","卡鲁德洛维奇","李翰博","邵佳一","毛剑卿","雷纳尔多"}; char birthday[][20]={"1987-05-14","1989-06-30","1983-01-15","1985-09-04","1991-02-20","1989-08-06","1979-02-05","1979-02-17","1989-07-18","1986-07-22","1991-01-17","1989-07-16","1989-11-30","1980-09-26","1981-08-12","1981-03-21","1982-08-28","1991-01-23","1985-02-14","1991-02-14","1983-10-19","1988-03-01","1989-06-28","1981-08-21","1989-02-18","1989-02-28","1989-09-01","1989-08-21","1991-05-15","1987-07-05","1991-01-26","1980-04-10","1986-08-08","1984-06-13"}; char location[][20]={"中国","塞内加尔","克罗地亚","葡萄牙","塞尔维亚","澳大利亚"}; char position[][20]={"门将","后卫","中场","前锋"}; int a[]={0,0,0,0,0,0,0,0,0,0,0,0,1,2,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,5}; int b[]={0,0,0,0,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3}; for(i=0;i<sizeof(a)/sizeof(*a);i++) { strcpy(p[i].Name,name[i]); strcpy(p[i].Birthday,birthday[i]); strcpy(p[i].Location,location[a[i]]); strcpy(p[i].Position,position[b[i]]); } return sizeof(a)/sizeof(*a);}
0 0
- 简单小课设
- 简单
- 简单
- 简单
- 简单
- 简单
- 简单
- 简单
- 简单
- 简单
- 简单
- 简单
- 简单
- 简单
- 简单
- 简单
- 简单简单
- 简单 简单 简单
- 硬盘分区、卷(有关动态磁盘)、簇
- JavaScript1.6数组新特性介绍以及JQuery的几个工具方法
- 计算二叉树的高度递归版本
- linux学习--linux目录详解2
- hbase介绍
- 简单小课设
- c++11 特性 final与override关键字
- ubuntu 安装路径
- java用freemarker导出word的问题
- 谨慎使用java自带线程池
- jQuery Ajax向某个页面传值并取得返回的数组
- 在C和Objective-C中绑定JavaScript--------------------------cocos2d-x 3.0正式版本(7.15)
- Java中字符串比较的注意点
- Citrix 服务器虚拟化之六 Xenserver虚拟机创建与快照