錯(cuò)哪里了?
string[] name = new string[] { "吳松", "錢東宇", "伏晨", "陳陸", "周蕊", "林日鵬", "何昆", "關(guān)欣" };
? ? ? ? ? ? ? ? int[] score = new int[] { 89, 90, 98, 56, 60, 91, 93, 85 };
? ? ? ? ? ? ? ? int max;
? ? ? ? ? ? ? ? int index = 0;
? ? ? ? ? ? ? ? max = score[0];
? ? ? ? ? ? ? ? for (int i = 1; i < score.Length; i++)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? if (score[i] > max)
? ? ? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ? max = score[i];
? ? ? ? ? ? ? ? ? ? ? ? index = i;
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? Console.WriteLine("分?jǐn)?shù)最高的是{0},分?jǐn)?shù)是{1}", name[index], max);
2019-04-23
max沒有值 if語句直接比較?