課程
/后端開發(fā)
/C#
/C#開發(fā)輕松入門
5天,還有帶回家的C語言,結(jié)束啦
2020-04-09
源自:C#開發(fā)輕松入門 6-8
正在回答
using System;using System.Collections.Generic;using System.Text;namespace projAboveAvg{??? class Program??? {??????? static void Main(string[] args)??????? {??????????? string[,] name = new string[,] { { "景珍", "90" }, { "林慧洋", "65" }, { "成蓉", "88" }, { "洪南昌", "70" }, { "龍玉民", "46" }, { "單江開", "81" }, { "田武山", "100" }, { "王三明", "68" } };? ? ? ? ? ?? int avg,sum=0;??????????? for (int i = 0; i < name.GetLength(0); i++)??????????? {??????????????? sum += int.Parse(name[i, 1]);??????????? }??????????? avg = sum / name.GetLength(0);??????????? Console.WriteLine("平均分是{0},高于平均分的有:", avg);??????????? for (int i = 0; i < name.GetLength(0); i++)??????????? {??????????????? if (avg < int.Parse(name[i, 1]))??????????????????? Console.Write(name[i, 0] + " ");??????????? }??????????? Console.ReadKey();??????? }??? }}
using System;using System.Collections.Generic;using System.Text;
namespace projAboveAvg{??? class Program??? {??????? static void Main(string[] args)??????? {??????????? string[] names = new string[] { "景珍", "林惠陽", "成蓉", "洪南昌", "龍玉民", "單江開", "田武山", "王三明", };??????????? int[] score = new int[] { 90, 65, 83, 70, 56, 81, 100, 68 };??????????? int avg, sum = 0;??????????? for (int i = 0; i < score.Length; i++)??????????? {??????????????? sum += score[i];??????????? }??????????? avg = sum / score.Length;??????????? Console.Write("平均分是{0},高于平均分的有:", avg);??????????? Console.ReadKey();??????????? int s = 76;??????????? for (int x = 0; x < score.Length; x++)??????????? {??????????????? if (score[x] > s)??????????????? {??????????????????? Console.Write(names[x]+' ');??????????????? }??????????? }??????? }??? }}
求個(gè)最佳答案,嘿嘿。
舉報(bào)
本門課程是C#語言的入門教程,將帶你輕松入門.NET開發(fā)
3 回答C#與C語言的不同處
3 回答c#語言控制臺(tái)中文亂碼
3 回答c#語言:從鍵盤輸入一個(gè)數(shù)
1 回答vs有沒有改變語言的工具
1 回答C#大家如何學(xué)
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2020-05-10
using System;
using System.Collections.Generic;
using System.Text;
namespace projAboveAvg
{
??? class Program
??? {
??????? static void Main(string[] args)
??????? {
??????????? string[,] name = new string[,] { { "景珍", "90" }, { "林慧洋", "65" }, { "成蓉", "88" }, { "洪南昌", "70" }, { "龍玉民", "46" }, { "單江開", "81" }, { "田武山", "100" }, { "王三明", "68" } };
? ? ? ? ? ?? int avg,sum=0;
??????????? for (int i = 0; i < name.GetLength(0); i++)
??????????? {
??????????????? sum += int.Parse(name[i, 1]);
??????????? }
??????????? avg = sum / name.GetLength(0);
??????????? Console.WriteLine("平均分是{0},高于平均分的有:", avg);
??????????? for (int i = 0; i < name.GetLength(0); i++)
??????????? {
??????????????? if (avg < int.Parse(name[i, 1]))
??????????????????? Console.Write(name[i, 0] + " ");
??????????? }
??????????? Console.ReadKey();
??????? }
??? }
}
2020-05-08
using System;
using System.Collections.Generic;
using System.Text;
namespace projAboveAvg
{
??? class Program
??? {
??????? static void Main(string[] args)
??????? {
??????????? string[] names = new string[] { "景珍", "林惠陽", "成蓉", "洪南昌", "龍玉民", "單江開", "田武山", "王三明", };
??????????? int[] score = new int[] { 90, 65, 83, 70, 56, 81, 100, 68 };
??????????? int avg, sum = 0;
??????????? for (int i = 0; i < score.Length; i++)
??????????? {
??????????????? sum += score[i];
??????????? }
??????????? avg = sum / score.Length;
??????????? Console.Write("平均分是{0},高于平均分的有:", avg);
??????????? Console.ReadKey();
??????????? int s = 76;
??????????? for (int x = 0; x < score.Length; x++)
??????????? {
??????????????? if (score[x] > s)
??????????????? {
??????????????????? Console.Write(names[x]+' ');
??????????????? }
??????????? }
??????? }
??? }
}
求個(gè)最佳答案,嘿嘿。