没写出来
没弄出来
建立两个数组,一个string型,一个int型,名字和分数要一一对应。。
string[] names = new string[]{"吴松","钱东宇","伏晨","陈陆","周浽","林日鹏","何昆","关欣"};
int[] score = new int[]{89,90,98,56,91,93,85};
int maxScore = score[0];//假设第一个是最高分
int jilu = 0; //记录分数最高的序列号
for (int i = 1; i < score.Length; i++)
{
if (score[i] > maxScore)
{
maxScore = score[i];
jilu = i;
}
}
Console.WriteLine("分数最高的是{0},分数是{1}",names[jilu],maxScore);
string[] name = new string[] { "景珍", "林辉洋", "成蓉", "洪南昌", "龙玉民", "单江开", "田武山", "王三明" };
int he = 0, pingjun = 0;
int[] fen = new int[] { 90, 65, 88, 70, 46, 81, 100, 68 };
for (int i = 0; i < fen.Length; i++)
{
he += fen[i];
}
pingjun = he / fen.Length;
for (int i = 0; i < fen.Length; i++)
{
if (fen[i] > pingjun)
{
Console.WriteLine("平均分是{0},高于平均分的有:{1}", pingjun, name[i]);
}
自己再去修改一下输出就行了
举报