| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 517 人关注过本帖
标题:帮帮忙,帮我写的这个运动会管理程序修改并注释一下,后面我不大会注释,拜 ...
只看楼主 加入收藏
漠漠清幽
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2010-12-29
结帖率:0
收藏
已结贴  问题点数:10 回复次数:3 
帮帮忙,帮我写的这个运动会管理程序修改并注释一下,后面我不大会注释,拜托!!!
#include <stdio.h>
#define A 100
Int y=0,f=0,j,W,M,N,p[15],q[15];
struct  student
{
  char  school[20];
  char  name[20];
  char  item[20];
  char  sex;
  int  position;
  int  mark;
}
stu[A];
struct  item
{
  char  name[20];
  char  sex;
  int  mark;
}
it[A];
struct  school
{
  char  name[20];
  char  item[20];
  int  mark;
}
sho[A];
main()
{
  menu();
}
menu()
{
  int  w1,n;
  do
{  put(“\t\t*****************MENU*****************”);
   put(“\n\n\t\t   1.The  information  to  writein\n”);
   put(“\t\t   2.The  race  result  records  to  writein\n”);
   put(“\t\t   3.Search  the  information\n”);
   put(“\t\t   4.Exit\n”);
   put(“\n\t\t***************************************”);
   put(“\n\nChoice  you  number:”);
   scanf(“%d”,&n);
    if(n<1||n>4){w1=1;getchar();}
    else  w1=0;
   }while(w1==1);
switch(n)
{   case 1:establish();break;
     case 2:enter();break;
     case 3:search();break;
     case 4:exit(0);
}
   }
   establish()
   {   int  h, r;  extern N,M,W;
   Y=1;
   printf(“\nThe  number  of  school  attended  is:”);
   scanf(“%d”,&N);
   printf(“\nThe  number  of  men  item  is:”);
   scanf(“%d”,&M);
   printf(“\nT    he  number  of  women  item  is:”);
   scanf(“%d”,&W);
   printf(“\nThere  are  three  form  of  marked  you  can  choice:”);
   printf(“\n\n\t1).1th—7,2th—5,3th—3,4th—2,5th—1.”);
   printf(“\n\n\t2).1th—5,2th—3,3th—1.”);
   printf(“\n\n\t3).define  by  youself.”);
   loop:printf(“\n\nChoice  the  number(1--3):”);
       scanf(“%d”,&h);
        if(h>0&&h<4)
          switch(h)
              {  case  1: j=1: berak;
                 case  2:j=2;break;
                 case  3:define_mark();
               }
             else  goto  loop;
             printf(“Success!!!\nPress  any  key+Enter  to  menu..”);
             scanf(“%d”,&r);
             menu();
            }
            enter()
             {  int  t, r, i=0; extern j, y;char F,M;
                If (y==0)
              {   printf(“Please  establish  system  first!!\nPress  any  key+Enter  to menu..”);
                  scanf(“%d”,&r);
                  menu();
                }
       do
        {
          printf(“\nPlease  enter  the  student’s  name:\t”);
          scanf(“%s”,&stu[i].name)
          printf(“\nPlease  enter  the  student’s  school:\t”);
          scanf(“%s”,&stu[i].school);
          printf(“\nPlease  enter  the  student’s  item:\t”);
          scanf(“%s”,&stu[i].item);
          loop_1: printf(“please  enter  the  student’s  sex(W  or  M):\t”);
          scanf(“%s”,&stu[i].sex);
          if(stu[i].sex!=’W’&&stu[i].sex!=’M’)goto  loop_1;
          printf(“\nPlease  enter  the  student’s  position:\t”);
          scanf(“%d”,&stu[i].position);
          mark(j,i);
        loop_2:printf(“\n\nDo  again?\t1).Yes\t2).No\t”);
          scanf(“%d”,&t);
          if(t!=2&&t!=1)goto  loop_2;
          if(t==2)break;
          i++;
          }  while(t==1); f=1;
          printf(“Success!!!\nPress  any  key+Enter  to  menu..”);
          scanf(“%d”,&r);
          menu();
          }
          search()
          {   int  e; char  c; extern  f;
           If(f==0)
          { printf(“Please enter the data first!!\nPress any key+Enter to menu..\n”);
            scanf(“%s”,&c);
             menu();
            }
         loop:printf(“\nThe form of searching you want to choice:\n\t1).By school\n\t2).Bt  item\n\t3).To  menu\t”);
              scanf(“%d”,&e);
              switch(e)
            {   case  1: search_school(); break;
                case  2: search_item(); break;
                case  3: menu();
              }
               if(e>4||e<1)goto loop;
               printf(“press  any  key+Enter  to  menu..”);scanf(“%s”,&c);menu();
              }
              
              search_school()

            {  int  x, sum=0,w=0;
               struct  student  s;
               printf(“\nplease  enter  the  name  of  the  school  that  you  want  to  search:”);
               scanf(“%s”,&s.school);
               printf_face(0;
               for(x=0;x<A;x++)
               if(strcmp(s.school,stu[x].school)= =0)
               {  sum+=stu[x].mark;
                  printf(“_one(x);w=1;
                }
                printf_sum(sum);
                if(w= =0 )
                {printf9’\n\n*The  name  is  wrong,press  again!”};search_school();}
               
               }
               search_item( )
               {  int  x, sum=0, w=0;
                  struct  student  s;
                  printf(“\nplease  enter  the  name  of  the  item  that  you  want  to  search:”);
                  scanf(“%s”,&s.item);
                  printf_face( );
                  for(x=0;x<A;x++)
                  if(strcmp(s.item,stu[x].item)= =0)
                  {  sum+=stu[x].mark;
                     printf_one(x);w=1;
                  }
printf_sum(sum);
if(w= =0)
{printf(“\n\n*The  name  is  wrong, press  again!”);search_item( );}
           
                 }
                 mark(int  j, int  i)
                 {  int  g;extern  p[15],q[15];
                    if(j= =1)
                      {if(stu[i].position= =1)stu[i].mark=7;
                       else  if(stu[i].position= =2)stu[i].mark=5;
                       else  if(stu[i].position= =3)stu[i].mark=3;
                       else  if(stu[i].position= =4)stu[i].mark=2;
                       else  if(stu[i].position= =5)stu[i].mark=1;
                 }  
              if(j= =2)
                {  if(stu[i].position= =1)stu[i].mark=5;
                   else  if(stu[i].position= =2)stu[i].mark=3;
                   else  if(stu[i].position= =3)stu[i].mark=1;
                 }
             if(j= =3)
                 { for(g=0;g<15;g++)if(stu[i].position= =p[g])stu[i].mark=q[g];}
             }

            define_mark( )
           { static  int  p[15],q[15],a,b,j;
            for (a=0;a<15;a++)
             {printf(“\nThe  position(1- -15):”);scanf9“%的”,&q[a]};  
              printf(“\nThe mark  you  want  to  define (Intergral):”);
scanf(“%d”,&q[a]);
loop:printf(“\nDo you  want  define  more:\t1).Yes\t2).No”);
scanf(“%d”,&b);
   .           if(b= =2)break;
               if(b!=1)go to loop;
}
j=3;
}

printf_one(int  x)
{ printf(“\n%-20s%-20s%-20s%-5c%-9d%-5d%’,stu[x].school,stu[x].item,stu[x].sex,stu[x].position,stu[x].mark);
}

printf_sum(int  sum)
{ printf(“\n\nThe  sum  of  mark  is:\t%d”,sum0;
 printf(“\nThe  school  number  is:\t%d”,N);
 printf(“\nThe  item  number  is:\t%d\n”,W+M);
}
printf_face( )
{
printf(“\n\nschool  name  school  nam  item   sex  position    mark”);
}
搜索更多相关主题的帖子: 运动会 
2010-12-30 15:27
pinglideyu
Rank: 3Rank: 3
来 自:武汉工程大学
等 级:论坛游侠
威 望:1
帖 子:735
专家分:140
注 册:2007-1-7
收藏
得分:10 
哎,你这个我直接无语。怎么帮你注释哦,太长。而你的思路我更不知道。

~~我的明天我知道~~
2010-12-30 16:32
漠漠清幽
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2010-12-29
收藏
得分:0 
那能不能给我写一个程序呀?要求像下面一样
学校运动会管理系统
采用数组建立运动会比赛结果信息表:
学校名,比赛项目,参赛运动员姓名,性别,获得名次
 系统实现功能:
(1) 初始化输入:N-参赛院系总数,M-男子竞赛项目数,W-女子竞赛项目数;
(2) 各项目名次取法有如下几种:
取前5名:第1名得分 7,第2名得分 5,第3名得分3,第4名得分2,第5名得分 1;         
(3) 由程序提醒用户填写比赛结果,输入各项目获奖运动员的信息。
(4) 所有信息记录完毕后,用户可以查询各个院系或个人的比赛成绩,生成团体总分报表,查看参赛院系信息、获奖运动员、比赛项目信息等。
2010-12-30 16:43
pinglideyu
Rank: 3Rank: 3
来 自:武汉工程大学
等 级:论坛游侠
威 望:1
帖 子:735
专家分:140
注 册:2007-1-7
收藏
得分:0 
对不起,我不会给你写的,我没有时间做这个。我只提供我的思路给你,你可以参考下
根据你的要求,我想  可以用结构体数组存储你的数据信息。
例如 定义(假设N是100,或者你在程序可以自行输入它)
 struct sports
{
....
.....
}
STU[N];
那么STU[1]存储第一个运动员的信息,包括学校名,参赛院系,参赛项目,姓名。。。。
其它运动员信息依次类推

那么如何查询呢?我们可以设置姓名为KEYWORDS(关键码)通过这个,查找相同信息的运动员,然后打印在屏幕上。

这个还比较好,其实是链表操作的同义改写,相比之后,这个更容易实现些。需要的知识包括,数组,结构体

~~我的明天我知道~~
2010-12-30 16:59
快速回复:帮帮忙,帮我写的这个运动会管理程序修改并注释一下,后面我不大会注释 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018668 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved