逗號都改中文了,還報錯?大神求解
using System;
using System.Collections.Generic;
using System.Text;
namespace projGetMaxScore
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? string[] names=new string[]{"吳松","錢東宇","伏晨","陳陸","周蕊","林日鵬","何昆","關欣"};
? ? ? ? ? ? int[] score=new int[]{89,90,98,56,60,91,93,85};
? ? ? ? ? ? int high=0;
? ? ? ? ? ? string s;
? ? ? ? ? ? foreach(int i in score){
? ? ? ? ? ? ? ? if(score[i]>high){
? ? ? ? ? ? ? ? ? ? high=score[i];
? ? ? ? ? ? ? ? ? ? s=names[i];
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ? ? Console.WriteLine ("分數最高的是{0},分數是{1}",s,high);
? ? ? ? ? ??
? ? ? ? }
? ? }
}
2020-02-09
string s;這個聲明時必須賦值,我改為string s=names[0];時就運行出來了