慕仰1312500
2018-08-04 22:57
string[] name = new string[]
{ "景珍","林惠洋","成蓉","洪南昌","龙玉名","单江开","田武山","王三明"};
int[] score = new int[]
{ 90,65,80,70,46,81,100,68};
int max;
int sum;
sum = 0;
for (int x = 0; x < score.Length; x++)
sum += score[x];
max = (sum / score.Length);
Console.Write("平均分是" + max + ",高于平均分的有:");
for (int x = 0; x < score.Length; x++)
if (max < score[x])
Console.Write(name[x] + " ");
int[] num = new int[]{
90,65,88,70,46,81,100,68
};
string[] name = new string[]{
"景珍","林惠洋","成蓉","洪南昌","龙玉民","单江开","田武山","王三明"
};
int max = num[0];//最高点
int sum = 0;//合計点
int avg = 0;//平均点
for (int i = 0; i < num.Length; i++)
{
if (max < num[i])
{
max = num[i];
}
}
for(int x = 0; x < num.Length; x++)
{
sum += num[x];
}
avg = sum / num.Length;//平均点の計算
Console.WriteLine("平均分是{0},高于平均分的有:", avg);
for (int n = 0; n < num.Length; n++)
{
if (num[n] > avg)
{
Console.Write(name[n]+" ");
}
}
你试试我这个,可以过的,基本就是符号是否是中文
第三个人是88分,不是80。如果还有问题的话可能是逗号和冒号不是中文的。。。
C#开发轻松入门
254118 学习 · 1459 问题
相似问题