我哪里有問題啊 我在vs上面都沒問題 在這里就不行
using System;
using System.Collections.Generic;
using System.Text;
namespace projGetMaxScore
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? string[] name = new string[] { "吳松", "錢東宇", "伏晨", "陳陸", "周蕊", "林日鵬", "何昆", "關(guān)欣" };
? ? ? ? ? ? int[] a = new int[] {89,90,98,56,60,91,93,85 };
? ? ? ? ? ? int max;
? ? ? ? ? ? max = a[0];
? ? ? ? ? ? int sy = 0;
? ? ? ? ? ? for(int i=1;i<a.Length;i++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if (a[i] > max)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? max = a[i];
? ? ? ? ? ? ? ? ? ? sy = i;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ? ? Console.Write("分數(shù)最高的是" +name[sy]+","+"分數(shù)是"+max);
? ? ? ? ? ??
? ? ? ? }
? ? }
}
2020-07-24
using System;
using System.Collections.Generic;
using System.Text;
namespace projGetMaxScore
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? int max;
? ? ? ? ? ? string[] name = new string[]{"吳松","錢東宇","伏晨","陳陸","周蕊","林日鵬","何昆","關(guān)欣"};
? ? ? ? ? ? int[] num = new int[]{89,90,98,56,60,91,93,85};
? ? ? ? ? ? max=num[0];
? ? ? ? ? ? string k =name[0];
? ? ? ? ? ? for(int i=1;i<num.Length;i++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if(num[i]>max)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? max=num[i];
? ? ? ? ? ? ? ? ? ? k=name[i];
? ? ? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ? ? Console.Write("分數(shù)最高的是{0},分數(shù)是{1},",k,max);
? ? ? ? }
? ? }
}
2020-07-06
?,看來不是我一個人是這個思路,?
2020-03-13
你的代碼沒錯,不對是因為名字和分數(shù)之間的,是中文的,你的是英文?
2020-03-13
using System;
using System.Collections.Generic;
using System.Text;
namespace projGetMaxScore
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? string[,] chengji=new string[,]{
? ? ? ? ? ? ? ? {"吳松","89"},{"錢東宇","90"},
? ? ? ? ? ? ? ? {"伏晨","98"},{"陳陸","56"},
? ? ? ? ? ? ? ? {"周蕊","60"},{"林日鵬","91"},
? ? ? ? ? ? ? ? {"何昆","93"},{"關(guān)欣","85"}
? ? ? ? ? ? };
? ? ? ? ? ? string[] zuigao=new string[2];
? ? ? ? ? ? for(int x=0; x<chengji.GetLongLength(0);x++){
? ? ? ? ? ? ? ? if(zuigao[0]!=null && Convert.ToInt32(zuigao[1])>Convert.ToInt32(chengji[x,1])) continue;
? ? ? ? ? ? ? ? else{
? ? ? ? ? ? ? ? ? ? zuigao[0]=chengji[x,0];
? ? ? ? ? ? ? ? ? ? zuigao[1]=chengji[x,1];
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ? ? Console.WriteLine("分數(shù)最高的是{0},分數(shù)是{1}",zuigao[0],zuigao[1]);
? ? ? ? }
? ? }
}
2020-03-05
代碼確實沒問題,我寫的也對就是在這上面不對,你的i從0開始比較規(guī)范,改一改