6-1幫我看看哪里錯了
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApptest1
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? int x=0;
? ? ? ? ? ? string[,] arr={{"吳松","89"},{"錢東宇","90"},{"伏晨","98"},{"陳陸","56"},{"周蕊","60"},{"林日鵬","91"},{"何昆","93"},{"關(guān)欣","85"}};
? ? ? ? ? ? int max = Convert.ToInt32(arr[1, 0]); ? ? ?//把吳松的89設(shè)為最高分 ?分數(shù)max因為是int類型所以要轉(zhuǎn)換
? ? ? ? ? ? for(int i=0;i<arr.GetLength(0);i++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if (max < Convert.ToInt32(arr[i, 1]))
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? max = Convert.ToInt32(arr[i, 1]);
? ? ? ? ? ? ? ? ? ? x=i;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ? ? Console.Write("分數(shù)最高的是{0},分數(shù)是{1}", arr[x,0], arr[x,1]);
? ? ? ? }
? ? }
}
2016-10-14
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApptest1
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? int x=0;
? ? ? ? ? ? string[,] arr=new string[,]={{"吳松","89"},{"錢東宇","90"},{"伏晨","98"},{"陳陸","56"},{"周蕊","60"},{"林日鵬","91"},{"何昆","93"},{"關(guān)欣","85"}};
? ? ? ? ? ? int max = Convert.ToInt32(arr[0, 1]); ? ? ?//把吳松的89設(shè)為最高分 ?分數(shù)max因為是int類型所以要轉(zhuǎn)換
? ? ? ? ? ? for(int i=0;i<arr.GetLongLength(0);i++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if (max < Convert.ToInt32(arr[i, 1]))
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? max = Convert.ToInt32(arr[i, 1]);
? ? ? ? ? ? ? ? ? ? x=i;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ? ? Console.Write("分數(shù)最高的是{0},分數(shù)是{1}", arr[x,0], arr[x,1]);
? ? ? ? }
? ? }
}
2016-10-09
已解決.
2016-10-09
x是用來儲存最高分的索引的