string[] name={"吴松","钱东宇","伏晨","陈陆","周蕊","林日鹏","何昆","关欣"};
int[]score={89,90,98,56,60,91,93,85};
int max=score[0];
string topName=null;
for(int i=0;i<score.Length;i++)
{
if(score[i]>max)
{
max=score[i];
topName=name[i];
}
}
Console.WriteLine("分数最高的是{0},分数是{1}",topName,max);
"分数最高的是{0},分数是{1}" 这句话里面的逗号改成中文的逗号
Console.WriteLine("分数最高是{0},分数是{1}",Topnum,Maximum);
只能说是里面有两个中文逗号,记住{0}后面一个逗号,{1}后面还有一个逗号
我的也显示打印正确可就是不过关 中文逗号也试了
string[] a = new string[]{ "吴松", "钱东宇", "伏晨", "陈陆", "周蕊", "林日鹏", "何昆", "关欣" };
int[] b = new int[] { 90, 90, 98, 56, 60, 91, 93, 95 };
int max=0;
int c=0;
for (int x = 0; x < a.Length; x++)
{
if (b[x] > max)
{
max = b[x];
c = x;
}
}
Console.Write("分数最高的{0},分数是{1}",a[c],b[c]);
using System;
using System.Collections.Generic;
using System.Text;
namespace projGetMaxScore
{
class Program
{
static void Main(string[] args)
{
int[] score = new int[] { 89, 90, 98, 86, 60, 91, 93, 85 };
string[] name = new string[] { "吴松", "钱东宇", "伏晨", "陈陆", "周蕊", "林日鹏", "何昆", "关欣" };
int max = 0;
string topName = null;
for (int i = 0; i < score.Length; i++)
if (score[i] > max)
{
max = score[i];
topName = name[i];
}
Console.Write("分数最高的是{0},分数是{1}", topName, max);
}
}
}