using System;using System.Collections.Generic;using System.Text;namespace projAboveAvg{??? class Program??? {??????? static void Main(string[] args)??????? {??????????? int[] score = { 90, 65, 88, 70, 46, 81, 100, 68 };??????????? string[] name = { "景珍", "林惠洋", "成蓉", "洪南昌", "龍玉民", "單江開", "田武山", "王三明" };??????????? int sum = 0, avg;??????????? for (int i = 0; i < score.Length; i++)??????????? {??????????????? sum += score[i];??????????? }??????????? avg = sum / score.Length;??????????? Console.WriteLine("平均分是{0}"+","+"高于平均分的有:",avg);??????????? int x;??????????? for (int i = 0; i < score.Length; i++)??????????? {??????????????? if (score[i]>avg)??????????????? {??????????????????? x = i;??????????????????? Console.Write(name[x]+" ");??????????????? }??????????? ???????????? }? ???????? }??? }}
1 回答

三思三思
TA貢獻1條經(jīng)驗 獲得超1個贊
找到了問題了,匹配不過就是因為一個逗號: ? Console.WriteLine("平均分是{0}"+","+"高于平均分的有:",avg);
使用中文輸入法的逗號。
- 1 回答
- 0 關(guān)注
- 1115 瀏覽
添加回答
舉報
0/150
提交
取消