第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

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

有沒有更簡單的代碼

using System;
using System.Collections.Generic;
using System.Text;

namespace projGetMaxScore
{
??? class Program
??? {
??????? static void Main(string[] args)
??????? {
????????????? object [,] names = new object[8, 2]{
??????????????? {"吳松",89},{"錢東宇",90},{"伏晨",98},{"陳陸",56},{"周蕊",60},{"林日鵬",91},{"何昆",93},{"關欣",85}
??????????? };
??????????? object temp = 0;
??????????? object maxscore = 0;
??????????? object name = null;
??????????? for (int i = 0; i < names.GetLongLength(0); i++)
??????????? {
??????????????? temp = names[i, 1];
??????????????? if ((int)maxscore < (int)temp)
??????????????? {
??????????????????? maxscore = temp;
??????????????????? name = (string)names[i, 0];
??????????????? }
??????????????? else
??????????????? {
??????????????????? continue;
??????????????? }
??????????? }
??????????? Console.Write("分數(shù)最高的是" + name + ",分數(shù)是" + maxscore+",");
??????? }
??? }
}

正在回答

7 回答

string [] name = new string [] { "吳松","錢東宇","伏晨","陳陸","周蕊","林日鵬","何昆","關欣" };

? ? ? ? ? ? int [] branch = new int [] { 89,90,98,56,60,91,93,85};

? ? ? ? ? ? int zuigao = 0;

? ? ? ? ? ? int index = 0;

? ? ? ? ? ? for(int i=0;i<branch.Length;i++){

? ? ? ? ? ? ? ? if(zuigao>branch[i] == false){

? ? ? ? ? ? ? ? ? ? zuigao = branch[i];

? ? ? ? ? ? ? ? ? ? index = i;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? ? ? Console.Write("分數(shù)最高的是{0},分數(shù)是{1}",name[index],branch[index]);


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

string [] name = new string [] { "吳松","錢東宇","伏晨","陳陸","周蕊","林日鵬","何昆","關欣" };

? ? ? ? ? ? int [] score = new int [] { 89,90,98,56,60,91,93,85};

? ? ? ? ? ? int high = 0;

? ? ? ? ? ? int index = 0;

? ? ? ? ? ? for(int i=0;i<score.Length;i++)

? ? ? ? ? ? {

? ? ? ? ? ? ? ? if(high<score[i])

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? high = score[i];

? ? ? ? ? ? ? ? ? ? index = i;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? ? ? Console.WriteLine("分數(shù)最高的是{0},分數(shù)是{1}",name[index],score[index]);


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

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

? ? ? ? ? ? int max = 0;

? ? ? ? ? ? int index=0;

? ? ? ? ? ? for (int i=0;i<test.GetLongLength(0);i++)

? ? ? ? ? ? {

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

? ? ? ? ? ? ? ? {

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

? ? ? ? ? ? ? ? ? ? index=i;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? ? ? Console.Write("分數(shù)最高的是{0},分數(shù)是{1}",test[index,0],max);


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

我把object的聲明改了。使用了兩種做法。

using System;
using System.Collections.Generic;
using System.Text;

namespace projGetMaxScore
{
??? class Program
??? {
??????? static void Main(string[] args)
??????? {
??????????? //第一種方法
????????????? string [,] names = new string[8, 2]{
??????????????? {"吳松","89"},{"錢東宇","90"},{"伏晨","98"},{"陳陸","56"},{"周蕊","60"},{"林日鵬","91"},{"何昆","93"},{"關欣","85"}
??????????? };
??????????? int temp = 0;
??????????? int maxscore = 0;
??????????? string name = null;
??????????? for (int i = 0; i < names.GetLongLength(0); i++)
??????????? {
??????????????? temp = int.Parse(names[i, 1]);
??????????????? if (maxscore < temp)
??????????????? {
??????????????????? maxscore = temp;
??????????????????? name = names[i, 0];
??????????????? }
??????????????? else
??????????????? {
??????????????????? continue;
??????????????? }
??????????? }
??????????? Console.Write("分數(shù)最高的是" + name + ",分數(shù)是" + maxscore+",");
???????????
??????????? //第二種方法索引法。
???????????? string[,] info = new string[8, 2] { { "吳松", "89" }, { "錢東宇", "90" }, { "伏晨", "98" }, { "陳陸", "56" }, { "周蕊", "60" }, { "林日鵬", "9" }, { "何昆", "93" }, { "關欣", "85" } };
????????????? int temp2 = 0;
????????????? for (int i = 0; i < info.GetLongLength(0); i++)
????????????? {
????????????????? if (int.Parse(info[i, 1]) > int.Parse(info[temp2, 1]))
????????????????? {
????????????????????? temp2 = i;
????????????????? }
????????????? }
????????????? Console.Write("分數(shù)最高的是" + info[temp2, 0] + ",分數(shù)是" + info[temp2, 1]);
??????? }
??? }
}

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

using System;

using System.Collections.Generic;

using System.Text;


namespace projGetMaxScore

{

? ? class Program

? ? {

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

? ? ? ? {

? ? ? ? ? ? string[]names={"吳松","錢東宇","伏晨","陳陸","周蕊","林日鵬","何昆","關欣"};

? ? ? ? ? ? int[]score={89,90,98,56,60,91,93,85};

? ? ? ? ? ? int MAX=score[0];

? ? ? ? ? ? string maxName=names[0];

? ? ? ? ? ? for(int i=0;i<score.Length;i++)

? ? ? ? ? ? {

? ? ? ? ? ? ? ? if(score[i]>MAX)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? MAX=score[i];

? ? ? ? ? ? ? ? maxName=names[i];

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? ? ? Console.Write("分數(shù)最高的是{0},分數(shù)是{1}",maxName,MAX);

? ? ? ? }

? ? }

}


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

請問為什么要用object?

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

qq_初五_3

一般不用object, 這個object是所有類型的基類,包含所有數(shù)據(jù)類型。
2018-07-25 回復 有任何疑惑可以回復我~
#2

慕粉2003103133 提問者 回復 qq_初五_3

object已經(jīng)改掉了
2018-07-31 回復 有任何疑惑可以回復我~

好好好

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

舉報

0/150
提交
取消
C#開發(fā)輕松入門
  • 參與學習       255653    人
  • 解答問題       1519    個

本門課程是C#語言的入門教程,將帶你輕松入門.NET開發(fā)

進入課程

有沒有更簡單的代碼

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

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號