我几秒钟就做出来了0.0
Console.WriteLine("分数最高的是伏晨,分数是98");
Console.WriteLine("分数最高的是伏晨,分数是98");
2019-03-11
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
namespace projGetMaxScore
{
class Program
{
static void Main(string[] args)
{
string[,] names = new string[,] { { "吴松", "89" }, { "钱东宇", "90" }, { "伏晨", "98" }, { "陈陆", "56" }, { "周蕊", "60" }, { "林日鹏", "91" }, { "何昆", "93" }, { "关欣", "85" } };
string student = "None";
int max = 0;
for (int i=0;i<8;i++)
{
int text= Convert.ToInt32(names[i, 1]);
string name = names[i,0];
if(text>max)
{
max=text;
student=name;
}
}
Console.WriteLine("最高分数的是"+student+",分数是"+max+"。");
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
namespace projGetMaxScore
{
class Program
{
static void Main(string[] args)
{
string []name={"吴松","钱东宇","伏晨","陈陆","周蕊","林日鹏","何昆","关欣"};
int [] grades= {89,90,98,56,60,91,93,85};
int k=0;
int max = grades[0];
for (int i=0;i<grades.Length;i++)
{
if (grades[i]>max)
{
max=grades[i];
k=i;
}
}
Console.WriteLine("最高分数的是"+name[k]+",分数是"+max+"。");
}
}
举报