qq_慕数据7323586
2022-09-08 16:22
using System;
using System.Collections.Generic;
using System.Text;
namespace projGetMaxScore
{
class Program
{
static void Main(string[] args)
{
string []names ={"吴松","钱东宇","伏晨","陈陆","周蕊","林日鹏","何昆","关欣"};
int []score={89,90,98,56,60,91,93,85};
for (int i=0;i<score.Length;i++)
{
if(score[0]<score[i])
{
score[0]=score[i];
names[0]=names[i];
}
}
Console.WriteLine("分数最高的是{0},分数是{1}",names[0],score[0]);
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace projGetMaxScore
{
class Program
{
static void Main(string[] args)
{
string[,]s={{"吴松","89"},{"钱东宇","90"},{"伏晨","98"},{"陈陆","56"},{"周蕊","60"},{"林日鹏","91"},{"何昆","93"},{"关欣","85"}} ;
for (int y = 0; y < s.GetLength(0)-1; y++)
{
if (Convert.ToInt32(s[0, 1]) < Convert.ToInt32(s[y + 1, 1]))
{
s[0,1]=s[y+1,1];
s[0,0]=s[y+1,0];
// Console.WriteLine("{0},{1}", s[0,0],s[0,1]);
}
}
Console.WriteLine("分数最高的是{0},分数是{1}", s[0,0],s[0,1]);
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace projAboveAvg
{
class Program
{
static void Main(string[] args)
{
string[,]s ={{"景珍","90"},{"林惠洋","65"},{"成蓉","88"},{"洪南昌","70"},{"龙玉民","46"},{"单江开","81"},{"田武山","100"},{"王三明","68"}};
int agv=0;
int sum=0;
for(int x =0 ;x<s.GetLength(0);x++)
{
sum = sum + Convert.ToInt32(s[x, 1]);
}
agv=sum/s.GetLength(0);
Console.WriteLine("平均分是"+agv+",高于平均分的有:");
for(int y=0;y<s.GetLength(0)-1;y++)
{
if(Convert.ToInt32(s[y,1])>agv)
Console.Write("{0} ",s[y,0]);
}
}
}
}
C#开发轻松入门
254118 学习 · 1459 问题
相似问题