| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 829 人关注过本帖
标题:莫名的错误,求指点!
只看楼主 加入收藏
mujiaha
Rank: 2
等 级:论坛游民
帖 子:37
专家分:65
注 册:2010-7-27
收藏
得分:0 
#include <stdio.h>
#include <string.h>
#define ARR_SIZE 40
#define ARR_SIZE1 40
main()
{char num[ARR_SIZE][ARR_SIZE1];
int sort(int score[ARR_SIZE],int n);
int score[ARR_SIZE];
int i,n,p;

scanf("%d",&n);
for(i=0;i<n;i++)
{scanf("%s",*(num+i));
 scanf("%d",&score[i]);}
p=sort(score,n);//返回最高分数所在的位置;
   printf("最高分数的学号%s\n",*(num+p));
   printf("最高分数%d\n",score[p]);
}
int sort(int score[ARR_SIZE],int n)//函数的作用是求出最高分数在数组num[]中的位置。
{int i,j,k;
j=score[0];
k=0;
for(i=1;i<n;i++)
  if(score[i]>j)
  {   j=score[i];
      k=i;
  }
  return(k);
}
这个可以用,还算比较简单。
2010-07-30 09:09
快速回复:莫名的错误,求指点!
数据加载中...
 
   



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

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