CUZT
2018-04-03 18:08
using System;
using System.Collections.Generic;
using System.Text;
namespace projGetMaxScore
{
class Program
{
static void Main(string[] args)
{
string[,] info = new string[8, 2] { { "吴松", "89" }, { "钱东宇", "90" }, { "伏晨", "98" }, { "陈陆", "56" }, { "周蕊", "60" }, { "林日鹏", "91" }, { "何昆", "93" }, { "关欣", "85" } };
/*int y=int.Parse(info[2,1]);
Console.WriteLine(y);*/
int x=0;
for(int i=0;i<8;i++)
{
if(int.Parse(info[i,1])>int.Parse(info[x,1]))
{
x=i;
}
else
{
x=x+0;
}
}
Console.WriteLine("分数最高的是"+info[x,0]+",分数是"+info[x,1]);
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace projGetMaxScore
{
class Program
{
static void Main(string[] args)
{
string[] names = {"吴松","钱东宇","伏晨","陈陆","周满","林日鹏","何昆","关欣"};
int[] scores = {89,90,98,56,60,91,93,85};
int maxI = 0;
int maxS = 0;
for(int i = 0; i < scores.Length; i++){
if(scores[i] > maxS){
maxS = scores[i];
maxI = i;
}
}
Console.WriteLine("分数最高的是{0},分数是{1}",names[maxI],maxS);
}
}
}
Console.WriteLine("分数最高的是"+info[x,0]+",分数是"+info[x,1]);
“,分数是”逗号应为中文逗号
C#开发轻松入门
254118 学习 · 1459 问题
相似问题