課程
/后端開發(fā)
/C#
/C#開發(fā)輕松入門
告訴我哪里不對?
2017-11-28
源自:C#開發(fā)輕松入門 6-8
正在回答
就是{0}后面的小逗號問題
using System;
using System.Collections.Generic;
using System.Text;
namespace projAboveAvg
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ? string[] name = { "景珍", "林惠洋", "成蓉", "洪南昌", "龍玉民", "單江開", "田武山", "王三明" };
? ? ? ? ? ? int[] score = { 90, 65, 88, 70, 46, 81, 100, 68 };
? ? ? ? ? ? int avg = 0;
? ? ? ? ? ? foreach (int x in score)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? avg += x;
? ? ? ? ? ? }
? ? ? ? ? ? avg /= score.Length;
? ? ? ? ? ? //Console.WriteLine("平均分是{0}, 高于平均分的有:",avg);
? ? ? ? ? ? Console.WriteLine("平均分是{0},高于平均分的有:",avg);
? ? ? ? ? ? for (int i = 0; i < score.Length; i++)
? ? ? ? ? ? ? ? if (score[i] > avg)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Console.Write(name[i]+" ");
? ? ? ? ? ? ? ? }
? ? ? ? ? ? Console.ReadKey();
? ? ? ? }
? ? }
}
沒毛病
舉報
本門課程是C#語言的入門教程,將帶你輕松入門.NET開發(fā)
2 回答想知道哪里有問題哎
7 回答暈掉,不知道哪里出了問題
2 回答不知道哪里錯了
1 回答不知道哪里出錯,求解
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學習伙伴
掃描二維碼關注慕課網(wǎng)微信公眾號
2017-12-14
就是{0}后面的小逗號問題
2017-12-14
using System;
using System.Collections.Generic;
using System.Text;
namespace projAboveAvg
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ? string[] name = { "景珍", "林惠洋", "成蓉", "洪南昌", "龍玉民", "單江開", "田武山", "王三明" };
? ? ? ? ? ? int[] score = { 90, 65, 88, 70, 46, 81, 100, 68 };
? ? ? ? ? ? int avg = 0;
? ? ? ? ? ? foreach (int x in score)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? avg += x;
? ? ? ? ? ? }
? ? ? ? ? ? avg /= score.Length;
? ? ? ? ? ? //Console.WriteLine("平均分是{0}, 高于平均分的有:",avg);
? ? ? ? ? ? Console.WriteLine("平均分是{0},高于平均分的有:",avg);
? ? ? ? ? ? for (int i = 0; i < score.Length; i++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if (score[i] > avg)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Console.Write(name[i]+" ");
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ? ? Console.ReadKey();
? ? ? ? }
? ? }
}
2017-11-28
沒毛病