using System;
using System.Collections.Generic;
using System.Text;
namespace projGetMaxScore
{
class Program
{
static void Main(string[] args)
{
string [,]Data=
{
{"吴松","89"},
{"钱东宇","90"},
{"伏晨","98"},
{"陈陆","56"},
{"周蕊","60"},
{"林日鹏","91"},
{"何昆","93"},
{"关欣","85"}
};
int y=int.Parse(Data[0,1]);
int z=0;
for(int x=0;x<Data.GetLongLength(0);x++)
{
if(y<int.Parse(Data[x,1]))
{
y=int.Parse(Data[x,1]);
z=x;
}
}
Console.Write("分数最高的是{0},分数是{1}",Data[z,0],Data[z,1]);
}
}
数组声明和赋值两种都可以的
string [,]Data=new string [,]
{
{"吴松","89"},
{"钱东宇","90"},
{"伏晨","98"},
{"陈陆","56"},
{"周蕊","60"},
{"林日鹏","91"},
{"何昆","93"},
{"关欣","85"}
};
int y=int.Parse(Data[0,1]);
int z=0;
for(int x=0;x<Data.GetLongLength(0);x++)
{
if(y<int.Parse(Data[x,1]))
{
y=int.Parse(Data[x,1]);
z=x;
}
}
Console.Write("分数最高的是{0},分数是{1}",Data[z,0],Data[z,1]);
}
数组声明和赋值语法错误了