逗號(hào)都改中文了,還報(bào)錯(cuò)?大神求解
using System;
using System.Collections.Generic;
using System.Text;
namespace projGetMaxScore
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? string[] names=new string[]{"吳松","錢東宇","伏晨","陳陸","周蕊","林日鵬","何昆","關(guān)欣"};
? ? ? ? ? ? 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 ("分?jǐn)?shù)最高的是{0},分?jǐn)?shù)是{1}",s,high);
? ? ? ? ? ??
? ? ? ? }
? ? }
}
2020-02-09
string s;這個(gè)聲明時(shí)必須賦值,我改為string s=names[0];時(shí)就運(yùn)行出來了