我的答案是這樣的
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" }, { "關(guān)欣", "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("分?jǐn)?shù)最高的是"+info[x,0]+",分?jǐn)?shù)是"+info[x,1]);
??????? }
??? }
}
2018-05-18
using System;
using System.Collections.Generic;
using System.Text;
namespace projGetMaxScore
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? string[] names = {"吳松","錢東宇","伏晨","陳陸","周滿","林日鵬","何昆","關(guān)欣"};
? ? ? ? ? ? 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("分?jǐn)?shù)最高的是{0},分?jǐn)?shù)是{1}",names[maxI],maxS);
? ? ? ? }
? ? }
}
2018-04-04
Console.WriteLine("分?jǐn)?shù)最高的是"+info[x,0]+",分?jǐn)?shù)是"+info[x,1]);
“,分?jǐn)?shù)是”逗號應(yīng)為中文逗號