从小白到基础 记录下最终的结果 一个多星期的学习 课程很棒 通俗易懂
string[] names = { "景珍 ", "林慧洋 ", "成蓉 ", "洪南昌 ", "龙玉民", "单江开", "田武山", "王三明"};//姓名数组
int[] score = { 90, 65, 88, 70, 46, 81, 100, 68 };//分数数组
int sum = 0;//声明总分
double avg = 0;//声明平均分
for(int i=0;i<names.Length;i++)
{
sum += score[i];
}
avg = (double)sum / names.Length;
Console.WriteLine("平均分是{0},高于平均分的有:", avg);
for(int i=0;i<names.Length;i++)
{
if (avg < score[i])
Console.Write(names[i] + " ");
}