为了账号安全,请及时绑定邮箱和手机立即绑定

​5天,还有带回家的C语言,结束啦

5天,还有带回家的C语言,结束啦

http://img1.sycdn.imooc.com//5e8f28f500013d0b07960611.jpg

正在回答

2 回答

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();
        }
    }
}

0 回复 有任何疑惑可以回复我~

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]+' ');
                }
            }
        }
    }
}

求个最佳答案,嘿嘿。

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
C#开发轻松入门
  • 参与学习       254034    人
  • 解答问题       1459    个

本门课程是C#语言的入门教程,将带你轻松入门.NET开发

进入课程

​5天,还有带回家的C语言,结束啦

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信