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

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

為什么結(jié)果就是不對

int[] fs= new int[4];

? ? ? ? ? ? string[] name = new string[4];

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

? ? ? ? ? ? string maxname=null;

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

? ? ? ? ? ? {

? ? ? ? ? ? ? ? Console.WriteLine("請輸入第" +(i+1) + "位學(xué)生的姓名");

? ? ? ? ? ? ? ? name[i]=Console.ReadLine();

? ? ? ? ? ? ? ? Console.WriteLine("請輸入第" +(i+1) + "位學(xué)生的成績");

? ? ? ? ? ? ? ? fs[i]=int.Parse(Console.ReadLine());

? ? ? ? ? ? ? ? if (fs[i] > max)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? max = fs[i];

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

? ? ? ? ? ? ? ? ? ??

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ??

? ? ? ? ? ? }

? ? ? ? ? ? Console.WriteLine("最大值是:" + max + "人是" + maxname);

? ? ? ? ? ??

? ? ? ??

? ? ? ? ? ? int sum = 0, avg=0;?

? ? ? ? ? ? for(int j=0;j<fs.Length;j++)

? ? ? ? ? ? {

? ? ? ? ? ? ? ? sum = sum + fs[j];

? ? ? ? ? ? ? ? avg = sum / fs.Length;

? ? ? ? ? ? ? ? if (fs[j]>avg)

? ? ? ? ? ? ? ??

? ? ? ? ? ? ? ? ? ??

? ? ? ? ? ? ? ? ? ? Console.WriteLine( name[j]);

? ? ? ? ? ? ? ? ? ?

? ? ? ? ? ? ? ??

? ? ? ? ? ? }


正在回答

2 回答

? ? ? ? ? ? int[] fs = new int[4];
??????????? string[] name = new string[4];
??????????? int max = fs[0];
??????????? string maxname = null;
??????????? int sum = 0;
??????????? for (int i = 0; i < name.Length; i++)
??????????? {
??????????????? Console.WriteLine("請輸入第" + (i + 1) + "位學(xué)生的姓名");
??????????????? name[i] = Console.ReadLine();
??????????????? Console.WriteLine("請輸入第" + (i + 1) + "位學(xué)生的成績");
??????????????? fs[i] = int.Parse(Console.ReadLine());
??????????????? if (fs[i] > max)
??????????????? {
??????????????????? max = fs[i];
??????????????????? maxname = name[i];

??????????????? }
??????????????? sum = sum + fs[i];
??????????? }
??????????? Console.WriteLine("最大值是:" + max + "人是" + maxname);

??????????? int avg;
??????????? avg = sum / fs.Length;
??????????? Console.WriteLine("平均分是{0},高于平均分的有",avg);
??????????? for (int j = 0; j < fs.Length; j++)
??????????? {
??????????????? if (fs[j] > avg)
??????????????? {
??????????????????? Console.WriteLine(name[j]+" ");
??????????????? }
??????????? }

//sum要放在第一個循環(huán)里,avg放在循環(huán)的外面,不然就是sum的第一個總值被除,而不是全部被除。

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

再縷縷思路

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

舉報

0/150
提交
取消

為什么結(jié)果就是不對

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

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

幫助反饋 APP下載

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

公眾號

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