首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

高人相助解决方案

2012-03-28 
高人相助void Scores(ResultType *result, ScoreType *score)/* 求各校的男、女总分和团体总分, 并依次存入

高人相助
void Scores(ResultType *result, ScoreType *score)
/* 求各校的男、女总分和团体总分, 并依次存入数组score */
/* 假设比赛结果已经储存在result[ ]数组中, */
/* 并以特殊记录 {"", male, ' ', "", 0 }(域scorce=0)*/
/* 表示结束 */
{ int i,n,m;
  while(result[i].sport!=NULL)
  score[ 0 ].totalscore+=result[i].score;
  for(i=0;i<n;i++)
  {
  if(result[i].gender==male) score[ 0 ].malescore+=result[i].score;
  else score[ 0 ].femalescore+=result[i].score;
  }
  for(m='A';m<='E';m++)
  {  
  printf("School %d:\n",m);
  printf("Total score of male:%d\n",score[i].malescore);
  printf("Total score of female:%d\n",score[i].femalescore);
  printf("Total score of all:%d\n\n",score[i].totalscore);
  }
}
这个程序哪儿错了?编译成功,但没有结果

[解决办法]

探讨
while(result[i].sport!=NULL)
score[ 0 ].totalscore+=result[i].score;

热点排行