哪里錯了,怎么不能運行出來
using System;
using System.Collections.Generic;
using System.Text;
namespace projGetMaxScore
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? string[] scores={89,80,98,56,60,91,93,85};
? ? ? ? ? ? string[] names={吳松,錢東宇,伏晨,陳陸,周蕊,林日鵬,何昆,關欣};
? ? ? ? ? ? int max=scores[0];
? ? ? ? ? ??
? ? ? ? ? ? for(int i=0;i<8;i++)
? ? ? ? ? ? if(max<scores[i])
? ? ? ? ? ? max=scores[i];
? ? ? ? ? ??
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine(最高分數(shù)是"+names[i]+",分數(shù)是"+max");
? ? ? ? ? ? }
? ? ? ? }
? ? }
}
using System;
using System.Collections.Generic;
using System.Text;
namespace projGetMaxScore
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? string[] scores={89,80,98,56,60,91,93,85};
? ? ? ? ? ? string[] names={吳松,錢東宇,伏晨,陳陸,周蕊,林日鵬,何昆,關欣};
? ? ? ? ? ? int max=scores[0];
? ? ? ? ? ??
? ? ? ? ? ? for(int i=0;i<8;i++)
? ? ? ? ? ? if(max<scores[i])
? ? ? ? ? ? max=scores[i];
? ? ? ? ? ??
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine(最高分數(shù)是"+names[i]+",分數(shù)是"+max");
? ? ? ? ? ? }
? ? ? ? }
? ? }
}
2017-10-02
if選擇語句里少“{}”大括號
2017-09-26
scores的數(shù)組不是整數(shù)類型的嗎?你用的是string類
int [] scores={89,80,98,56,60,91,93,85};
? ? ? ? ? ? string[] names={"吳松","錢東宇","伏晨","陳陸","周蕊","林日鵬","何昆","關欣"};
? ? ? ? ? ? int max=scores[0];
? ? ? ? ? ? int index = 0;
? ? ? ? ? ? for (int ?i = 0; i < 8; i++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if (max < scores[i])
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? max = scores[i];
? ? ? ? ? ? ? ? ? ? index = i;
??
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ??
? ? ? ? ? ? }
? ? ? ? ? ? Console.WriteLine("最高分數(shù)是" + names[index] + ",分數(shù)是" + max);
2017-09-26
你的“最高分數(shù)是”你是不是缺了前面的 ”?這里用的是字符串