三元运算符写法
using System;
using System.Collections.Generic;
using System.Text;
namespace projGetMaxScore
{
class Program
{
static void Main(string[] args)
{
string[] name = {"吴松","钱东宇","伏晨","陈陆","周芯","林日鹏","何昆","关欣"};
int[] score = {89,90,98,56,60,91,93,85};
int temp = -1;
int num = 0;
for (int i = 0; i < score.Length; i++) {
temp = score[i] > temp ? score[i] : temp;
num = temp == score[i] ? i : num;
}
Console.Write("分数最高的是{0},分数是{1}",name[num],score[num]);
}
}
}