不知道哪里錯(cuò)了
namespace ConsoleApp11
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? string[] names = new string[8] { "吳松", "錢東宇", "伏晨", "陳陸", "周蕊", "林日鵬", "何昆", "關(guān)欣" };
? ? ? ? ? ?int[] scores = new int[8] { 89, 90, 98, 56, 60, 91, 93, 85 };
? ? ? ? ?
? ? ? ? ? ? int x = 0;
? ? ? ? ? ? for (x=0;x<8;x++ )
? ? ? ? ? ? {? ??
? ? ? ? ? ? ? ? if (scores[x] > scores[0])
? ? ? ? ? ? ? ? {? ?
? ? ? ? ? ? ? ? ? ? scores[0] =scores[x];
? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ?}
? ? ? ? ? ? int max = scores[0];
? ? ? ? ? ?Console.Write("分?jǐn)?shù)最高的是" + names[x] + "分?jǐn)?shù)是" + max );
? ? ? ? }
? ? }
}
2018-07-11
字符串name為空
2018-07-05
改成這樣
? string[] names = new string[8] { "吳松", "錢東宇", "伏晨", "陳陸", "周蕊", "林日鵬", "何昆", "關(guān)欣" };
? ? ? ? ? ?int[] scores = new int[8] { 89, 90, 98, 56, 60, 91, 93, 85 };
? ? ? ? ? ? string name = null;
? ? ? ? ? ? int x = 0;
? ? ? ? ? ? for (x=0;x<8;x++ )
? ? ? ? ? ? {? ??
? ? ? ? ? ? ? ? if (scores[x] > scores[0])
? ? ? ? ? ? ? ? {? ?
? ? ? ? ? ? ? ? ? ? scores[0] =scores[x];
? ? ? ? ? ? ? ? ? ? name=names[x];
? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ?}
? ? ? ? ? ? int max = scores[0];
? ? ? ? ? ?
? ? ? ? ? ?Console.Write("分?jǐn)?shù)最高的是{0},分?jǐn)?shù)是{1}",name,max );
第三行是什么意思