我在VS上運(yùn)算成功,在這里為什么不行?
static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? int max =0;
? ? ? ? ? ? string[] names = { "吳松", "錢東宇", "伏晨","陳陸","周蕊","林日鵬","何昆","關(guān)欣" };
? ? ? ? ? ? int[] score = { 89, 90, 98,56,60,91,93,85 };
? ? ? ? ? ? for(int x=0;x<score.Length;x++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if (score[x]>score[max])
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? max++;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ? ?Console.WriteLine("分?jǐn)?shù)最高的是{0},分?jǐn)?shù)是{1}",names[max],score[max]);
? ? ? ? }
2017-10-04
max++; ? 錯了,應(yīng)是把x的值付給max,正確答案是:max=x;