請問為什么這段代碼執(zhí)行不了?
為什么這串代碼執(zhí)行不了?目的是為了挑出最大值。
static void Main(string[] args)
??????? {
??????????? int N=0;
??????????? int[]score={89,90,98,56,60,91,93,85};
??????????? string[]name={"吳松","錢東宇","伏晨","陳陸","周蕊","林日鵬","何昆","關(guān)欣"};
??????????? for (int i=0;i<score.Length;i++)
??????????? if N<score[i]
??????????? {
??????????????? N=i;
??????????? }
??????????? Console.WriteLine("分數(shù)最高的是{0},分數(shù)是{1}",name[N],score[N]);
??????? }
2018-05-05
static void Main(string[] args)
??????? {
??????????? int[] score={89,90,98,56,60,91,93,85};
??????????? string[] name={"吳松","錢東宇","伏晨","陳陸","周蕊","林日鵬","何昆","關(guān)欣"};
????????????int N=score[0];//假設(shè)第一個分是最高分
??????????? for (int i=1; i<score.Length; i++)
????????????{
??????????? if (N < score[i])
??????????? {
??????????????? N=score[i];
??????????? }
????????????}
??????????? Console.WriteLine("分數(shù)最高是{0}",N);
??????? }
這是求最大值的方法,,這是我的拙見。。。。。
2018-03-30
有人么?