運(yùn)行成功輸出錯誤啊,也沒錯啊?
???????????? String[] name = { "景珍", "林慧洋", "成蓉", "洪南昌", "龍玉民", "單江開", "田武山", "王三名" };
??????????? int[] score = { 90, 65, 88, 70, 49, 81, 100, 68 };
??????????? int sum = 0;
??????????? string getname = null;
??????????? for (int i = 0; i < score.Length; i++)
??????????? {
??????????????? sum += score[i];
??????????? }
??????????? double avg = sum / score.Length;
??????????? for (int i = 0; i < name.Length; i++)
??????????? {
??????????????? if (score[i] >= avg)
??????????????? {
??????????????????? getname += name[i] + " ";
??????????????? }
??????????? }
??????????? Console.WriteLine("平均分是,"+avg +"高于平均分的有:"+ getname);
2019-01-24
這系統(tǒng)判定輸出成功的條件是你輸出的必須和他任務(wù)上提示的結(jié)果一摸一樣才行,中英文的標(biāo)點(diǎn)符號弄錯了都不行
2018-12-25
?string[] Name = {"景珍","林惠洋","成蓉","洪南昌","龍玉民","單江開","田武山","王三明"};
? ? ? ? ? ? int[] Result = {90,65,88,70,46,81,100,68};
? ? ? ? ? ? // 設(shè)置平均分變量
? ? ? ? ? ? int AVG = 0;
? ? ? ? ? ? // 循環(huán)得出平均分
? ? ? ? ? ? for(int i = 0; i < Result.Length; i++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? AVG += Result[i];
? ? ? ? ? ? }
? ? ? ? ? ? // 得出平均分?jǐn)?shù)值
? ? ? ? ? ? AVG = AVG/Result.Length;
? ? ? ? ? ? // 打印輸出
? ? ? ? ? ? Console.WriteLine("平均分是{0},高于平均分的有:" , AVG);
? ? ? ? ? ? // 循環(huán)出高于平均分的名稱
? ? ? ? ? ? for(int i = 0; i < Name.Length; i++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? // 判斷是否高于平均分
? ? ? ? ? ? ? ? if(Result[i] >= AVG)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Console.Write("{0}? " , Name[i]);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
2018-12-13
輸出的那個,是中文輸入。不知道是不是這個問題