From f8de3489e84b6977efbe014f435809cdd9d76a31 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 9 Jan 2019 19:22:33 +0800 Subject: [PATCH] first commit --- 改版歌手比赛系统.cpp | 211 +++++++++++++++++++++++++++++++++++ 1 file changed, 211 insertions(+) create mode 100644 改版歌手比赛系统.cpp diff --git a/改版歌手比赛系统.cpp b/改版歌手比赛系统.cpp new file mode 100644 index 0000000..dbe95e0 --- /dev/null +++ b/改版歌手比赛系统.cpp @@ -0,0 +1,211 @@ +#include +#include +#include + +#define N 100 /*¸èÊÖÈËÊý×î¶à100ÈË*/ +#define M 10 /*ÆÀίÈËÊý10ÈË*/ + + struct player + { + int num; /*¸èÊÖ±àºÅ*/ + char name[100]; /*¸èÊÖÐÕÃû*/ + int score[10]; /*ÆÀί´ò·Ö³É¼¨*/ + float ave; /*¸èÊÖµÄƽ¾ù·Ö*/ + int index; + }singer[M]; + +void f1(struct player singer[],int n) /*f1ÊÇÊäÈëÑ¡ÊÖÐÅÏ¢µÄº¯Êý*/ +{ +int i; +for(i=0;i10) +{ + printf("ÊäÈë´íÎóÇëÖØÐÂÊäÈë:\n"); + goto loop; +} + +} +printf("\n\n"); +} + + +int main(void) +{ +int n,i,j,c,sum=0; + system("color f9"); /*¸Ä±ä´°¿ÚÑÕÉ«*/ +printf(" ¸èÊÖ±ÈÈüϵͳ \n"); + printf("\n"); + printf(" 1 ÊäÈë¸èÊÖÊý¾Ý \n"); + printf(" 2 ÆÀί´ò·Ö \n "); + printf(" 3 ¼ÆËãƽ¾ù·Ö \n"); + printf(" 4 ³É¼¨ÅÅÐò \n"); + printf(" 5 ²éѯ¸èÊÖÐÅÏ¢ \n"); + printf(" 6 ×·¼Ó¸èÊÖ \n"); + printf(" 7 °ÑÊý¾ÝдÈëÎļþ \n"); + printf(" 8 Í˳öϵͳ \n"); + do + + { + printf("ÊäÈëÐòºÅ½øÐвÙ×÷:"); + scanf("%d",&n); + + switch(n) + { + + case 1: + + + printf("ÊäÈë¸èÊÖÈËÊý(×î¶àÊäÈë100Ãû¸èÊÖ): "); + scanf("%d",&c); + if(c>0&&c<=100) + + f1(singer,c); + + else + + printf("ÊäÈë´íÎóÖØÐÂÊäÈëÐòºÅ½øÐвÙ×÷\n"); + break; + + + + case 2: + for(i=0;isinger[i].score[j]) + Min[i]=singer[i].score[j]; + } + singer[i].ave=(sum[i]-Max[i]-Min[i])/(M-2); + } + for(i=0;isinger[k].ave) + k=j; + temp=singer[k]; + singer[k]=singer[i]; + singer[i]=temp; + + } + printf("¸÷λ¸èÊÖ°´Æ½¾ù·Ö½øÐÐÅÅÐò´Ó¸ßµ½µÍÈçÏÂ:\n\n "); + for(i=0;i