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

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

這個是哪里錯誤,哪位大神能解惑下

using System;

using System.Collections.Generic;

using System.Text;


namespace projGetMaxScore

{

? ? class Program

? ? {

? ? ? ? static void Main(string[] args)

? ? ? ? {

? ? ? ? ? ? string [,] score =new string [2,8]{{"吳松","錢東宇","付晨","陳陸","周蕊","林日鵬","何昆","關欣"},{"89","90","98","56","60","91","93","85"}};

? ? ? ? ? ? int i=0;

? ? ? ? ? ? for (int j=1;j<=8;j++)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ??

? ? ? ? ? ? ? ? ? ? if (String.Compare(score[1,j],score[1,i])>0)

? ? ? ? ? ? ? ? ? ? i=j;

? ? ? ? ? ? ? ? }? ??

? ? ? ? ? ? ? ? Console.Write("分數最高的是{0},分數是{1}",score[0,i],score[1,i]);

? ? ? ? ??

? ? ? ? }

? ? }

}


正在回答

2 回答

string[,]? s = { { "吳松", "89" }, { "錢東宇", "90" }, { "伏晨", "98" }, { "陳陸", "56" }, { "周蕊", "60" }, { "林日鵬", "91" }, { "錢東宇", "90" }, { "何昆", "93" }, { "關欣", "85" } };?

? ? ? ? ??

?int max = 0;

? ? ? ? ? ? for (int i = 2; i <s.Length / 2 ; i++)

? ? ? ? ? ? {


? ? ? ? ? ? ? ? if (i==2) {

? ? ? ? ? ? ? ? ? ? if (int.Parse(s[0, 1]) < int.Parse(s[1, 1])) {

? ? ? ? ? ? ? ? ? ? ? ? max = int.Parse(s[1, 1]);

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? else {

? ? ? ? ? ? ? ? ? ? ? ? max = int.Parse(s[i, 1]);

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ??

? ? ? ? ? ? ? ? }


? ? ? ? ? ? ? ? if (int.Parse(s[i, 1]) < max)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? max = max;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? else {

? ? ? ? ? ? ? ? ? ? max = int.Parse(s[i, 1]);

? ? ? ? ? ? ? ? }

? ? ? ? ? ??

? ? ? ? ? ? }


? ? ? ? ? ? string name ="";

? ? ? ? ? ? for (int y = 0; y < s.Length / 2 ; y++) {


? ? ? ? ? ? ? ? if (int.Parse(s[y, 1]) == max)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? name = s[y, 0];

? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? ? ??

? ? ? ??

? ? ? ? ? ?Console.WriteLine("分數最高的是"+name+","+"分數是"+max);

? ? ? ? ? ??


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

你上面成績也是定義的字符型,字符型不可以比較大小,你要是想比較大小就要把成績轉化成int,double,folat型

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

舉報

0/150
提交
取消

這個是哪里錯誤,哪位大神能解惑下

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

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

幫助反饋 APP下載

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

公眾號

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