亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

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"},{"關欣","85"}};

? ? ? ? ? ? int max = Convert.ToInt32(arr[1, 0]); ? ? ?//把吳松的89設為最高分 ?分數max因為是int類型所以要轉換

? ? ? ? ? ? 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("分數最高的是{0},分數是{1}", arr[x,0], arr[x,1]);

? ? ? ? }

? ? }

}


正在回答

3 回答

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"},{"關欣","85"}};

? ? ? ? ? ? int max = Convert.ToInt32(arr[0, 1]); ? ? ?//把吳松的89設為最高分 ?分數max因為是int類型所以要轉換

? ? ? ? ? ? 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("分數最高的是{0},分數是{1}", arr[x,0], arr[x,1]);

? ? ? ? }

? ? }

}


0 回復 有任何疑惑可以回復我~

已解決.

0 回復 有任何疑惑可以回復我~
#1

巴塞羅那之戀

怎么改的啊
2017-06-16 回復 有任何疑惑可以回復我~

x是用來儲存最高分的索引的

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

6-1幫我看看哪里錯了

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號