代碼效果一樣,通不過
using System;
using System.Collections.Generic;
using System.Text;
namespace projAboveAvg
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? string[] name = new string[] { "景珍", "林惠洋", "成蓉", "洪南昌", "龍玉民", "單江開", "田武山", "王三明" };
? ? ? ? ? ? int[] score = new int[] { 90, 65, 88, 70, 46, 81, 100, 68 };
? ? ? ? ? ? int sum = 0;
? ? ? ? ? ? int avg = 0;
? ? ? ? ? ? foreach (int j in score)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? sum += j;
? ? ? ? ? ? }
? ? ? ? ? ? avg = sum / score.Length;
? ? ? ? ? ? Console.WriteLine("平均分是{0}", + avg + ", 高于平均分的有:");
? ? ? ? ? ? for (int i = 0; i < score.Length; i++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if (score[i] > avg)
? ? ? ? ? ? ? ? ? ? Console.Write(name[i] + " ");
? ? ? ? ? ? }
? ? ? ? }
? ? }
}
2018-07-04
標(biāo)準(zhǔn)答案上的結(jié)果中的逗號(hào)和冒號(hào)都是中文格式下的“,”和“:”,你這里寫的都是英文格式的","和":"。
2018-01-23
你到電腦當(dāng)中的visual studio 當(dāng)中試試