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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

6-1中的習(xí)題如果加上語(yǔ)數(shù)外三個(gè)科目的成績(jī)表該如何編寫,望大神告知一二!

6-1中的習(xí)題如果加上語(yǔ)數(shù)外三個(gè)科目每個(gè)學(xué)生的成績(jī)表該如何編寫,望大神告知一二!

正在回答

2 回答

using System;

using System.Collections.Generic;

using System.Text;


namespace projGetMaxScore

{

? ? class Program

? ? {

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

? ? ? ? {

? ? ? ? ? //語(yǔ)數(shù)外三科 可以用二維數(shù)組來(lái)寫

? ? ? ? ? ?//{{語(yǔ)文成績(jī),數(shù)學(xué)成績(jī),英語(yǔ)成績(jī)}}

? ? ? ? ? ? int[,] score = new int[5,3]{ {98,88,95 },{80,60,56}, {75,40,90 }, {68,50,23}, {82,100,85} };

? ? ? ? ? ? string[] name = new string[] { "1吳松", "2錢東宇", "3伏晨", "4陳陸", "5周蕊"};

? ? ? ? for(int j=0;j<3;j++)

? ? ? ? {

? ? ? ? ? ? int Max= 0;

? ? ? ? ? ? string MaxName = null;

? ? ? ? ? ? ? for (int i = 0; i < 5; i++)

? ? ? ? ? ? {

? ? ? ? ? ? ? ? if (score[i,j] > Max)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? Max = score[i,j];

? ? ? ? ? ? ? ? ? ? MaxName = name[i];

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }??

? ? ? ? ? ? switch(j)?

? ? ? ? ? ? {

? ? ? ? ? ? ?case 0 :? Console.WriteLine("語(yǔ)文分?jǐn)?shù)最高的是{0},分?jǐn)?shù)是{1},", MaxName, Max); continue;

? ? ? ? ? ? ?case 1 : Console.WriteLine("數(shù)學(xué)分?jǐn)?shù)最高的是{0},分?jǐn)?shù)是{1},", MaxName, Max);? continue;?

? ? ? ? ? ? ?case 2 : Console.WriteLine("英語(yǔ)分?jǐn)?shù)最高的是{0},分?jǐn)?shù)是{1},", MaxName, Max); continue;? ? ? ? ? ?

? ? ? ? ?}

? ? ? ? ? ? }? ? ??

? ? ? ? ? ? Console.ReadKey();? ?

? ? ? ? }

? ? }

}

//減少?gòu)?fù)雜性

0 回復(fù) 有任何疑惑可以回復(fù)我~

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;


namespace test

{

? ? public class Program

? ? {

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

? ? ? ? {

? ? ? ? ? ? //語(yǔ)數(shù)外三科 可以用二維數(shù)組來(lái)寫

? ? ? ? ? ? //{{語(yǔ)文成績(jī),數(shù)學(xué)成績(jī),英語(yǔ)成績(jī)}}

? ? ? ? ? ? int[,] score = new int[5,3]{ {98,88,95 },{80,60,56}, {75,40,90 }, {68,50,23}, {82,100,85} };

? ? ? ? ? ? string[] name = new string[] { "1吳松", "2錢東宇", "3伏晨", "4陳陸", "5周蕊"};


? ? ? ? ? ? int MaxChinese = 0;

? ? ? ? ? ? int MaxMath = 0;

? ? ? ? ? ? int MaxEnglish = 0;

? ? ? ? ? ? string MaxChineseName = null;

? ? ? ? ? ? string MaxMathName = null;

? ? ? ? ? ? string MaxEnglishName = null;

? ? ? ? ? ? for (int i = 0; i < 5; i++)

? ? ? ? ? ? {

? ? ? ? ? ? ? ? if (score[i,0] > MaxChinese)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? MaxChinese = score[i,0];

? ? ? ? ? ? ? ? ? ? MaxChineseName = name[i];

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? ? ? Console.WriteLine("語(yǔ)文分?jǐn)?shù)最高的是{0},分?jǐn)?shù)是{1},", MaxChineseName, MaxChinese);

? ? ? ? ? ? for (int j = 0; j < 5; j++)

? ? ? ? ? ? {

? ? ? ? ? ? ? ? if (score[j,1] > MaxMath)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? MaxMath = score[j,1];

? ? ? ? ? ? ? ? ? ? MaxMathName = name[j];

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? ? ? Console.WriteLine("數(shù)學(xué)分?jǐn)?shù)最高的是{0},分?jǐn)?shù)是{1},", MaxMathName, MaxMath);

? ? ? ? ? ? for (int k = 0; k < 5; k++)

? ? ? ? ? ? {

? ? ? ? ? ? ? ? if (score[k,2] > MaxEnglish)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? MaxEnglish = score[k,2];

? ? ? ? ? ? ? ? ? ? MaxEnglishName = name[k];

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? ? ? Console.WriteLine("英語(yǔ)分?jǐn)?shù)最高的是{0},分?jǐn)?shù)是{1},", MaxEnglishName, MaxEnglish);

? ? ? ? ? ? Console.ReadKey();

? ? ? ? }

? ? }

}

寫的比較冗余,期待有誰(shuí)貼出更精簡(jiǎn)的代碼, 共同學(xué)習(xí)一下 謝謝。

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

慕仔4095262 提問(wèn)者

正在入門階段感謝受教
2018-09-20 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

6-1中的習(xí)題如果加上語(yǔ)數(shù)外三個(gè)科目的成績(jī)表該如何編寫,望大神告知一二!

我要回答 關(guān)注問(wèn)題
微信客服

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

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)