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

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

這樣可行嗎???

string[]name=new string{名字}; int[]sorce=new int[]{分?jǐn)?shù)}; int max=0; int i=0; for(int x in sorce) { if(x>=max) { max=x; i++;}} ? ? Console.Write("分?jǐn)?shù)最高為{0}"+name[i]+",分?jǐn)?shù)是{1}"+sorce[i]); 這樣可行嗎???

正在回答

3 回答

string[]name=new string[]{"吳松","前東宇","伏晨","陳陸","周瑞","林日鵬","何坤","關(guān)欣"};

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

? ? ? ? ? ? int max=sorce[0];

? ? ? ? ? ? int y = 0; int x;//x為sorce數(shù)組的索引號(hào),y為name數(shù)組的所以號(hào)

? ? ? ? ? ? for(x=0;x<sorce.Length;x++)

? ? ? ? ? ? {

? ? ? ? ? ? ? if(sorce[x]>max)

? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? max=sorce[x];

? ? ? ? ? ? ? ? y=x;

? ? ? ? ? ? ? }

? ? ? ? ? ? ?}

? ? ? ? ? ? Console.Write("分?jǐn)?shù)最高的是{0}"+",分?jǐn)?shù)是{1}",name[y],max);

//改成這樣就對(duì)了,運(yùn)行過了

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

郭榮俊GG 提問者

非常感謝!
2016-03-28 回復(fù) 有任何疑惑可以回復(fù)我~

using System;

using System.Collections.Generic;

using System.Text;


namespace projGetMaxScore

{

? ? class Program

? ? {

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

? ? ? ? {

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

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

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

? ? ? ? ? ? string maxname=name[0];

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

? ? ? ? ? ? {

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

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? max=score[i];

? ? ? ? ? ? ? ? ? ? maxname=name[i];

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? ? ? Console.WriteLine("分?jǐn)?shù)最高的是{0},分?jǐn)?shù)是{1}",max,maxname);

? ? ? ? }

? ? }

}


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

?string[]name=new string[]{"吳松","前東宇","伏晨","陳陸","周瑞","林日鵬","何坤","關(guān)欣"};
????????? int[]sorce=new int[]{89,90,98,56,60,91,93,85};
????????? int max=sorce[0];
????????? int y=0;
????????? for(int x=0;x<=sorce.Length;x++)
????????? {
????????????? if(sorce[x]>max)
????????????? {
????????????? max=sorce[x];
????????????? y=x;
????????????? }
????????? }
??????????? if( max=sorce[x])
?????????????
????????? Console.Write("分?jǐn)?shù)最高的是{0}"+",分?jǐn)?shù)是{1}",name[y],max);

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

舉報(bào)

0/150
提交
取消

這樣可行嗎???

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

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

幫助反饋 APP下載

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

公眾號(hào)

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