namespace 集合习题练一练
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入你们班的人数:");
            int n = Convert.ToInt32(Console.ReadLine());
            ArrayList al = new ArrayList();
            for (int i = 0; i < n; i++)
            {
                Console.WriteLine("第"+(i+1)+"个同学的成绩为:");
                al.Add(Convert.ToInt32(Console.ReadLine()));
            }
            for (int i = 0; i < al.Count; i++)
            {
                Console.WriteLine("同学们的成绩依次为"+al[i]+"分");
            }
            double sum = 0;

for (int i = 0; i < n; i++)
            {
                sum = sum + Convert.ToInt32(al[i]);
            }
            Console.WriteLine("总分为"+sum+"分");
            al.Sort();
            for (int i = 0; i < al.Count; i++)
            {
                Console.WriteLine("同学们的成绩按照一定顺序排列为" + al[i] + "分");
            }
            double ave = 0;
            ave = (sum - Convert.ToInt32(al[0]) - Convert.ToInt32(al[4])) / (al.Count-2);
            Console.WriteLine("你们班的平均分为"+ave+"分");

Console.ReadLine();
        }
    }
}

集合ArrayList习题练一练——分数的更多相关文章

  1. 集合ArrayList双色球练一练(自己的方法,太麻烦)

    namespace 集合__双色球练一练{    class Program    {        static void Main(string[] args)        {        / ...

  2. Java ArrayList和Vector、LinkedList与ArrayList、数组(Array)和列表集合(ArrayList)的区别

    ArrayList和Vector的区别ArrayList与Vector主要从二方面来说.  一.同步性:   Vector是线程安全的,也就是说是同步的,而ArrayList是线程序不安全的,不是同步 ...

  3. 集合ArrayList

    /*集合ArrayList * 例如: * 1.创建:ArrayList<Egg> myList = new ArrayList<Egg>(); *      Egg类型的集合 ...

  4. 面向对象之集合ArrayList

    using System; using System.Collections; using System.Collections.Generic; using System.Linq; using S ...

  5. 集合及特殊集合arrayList

    1,运用集合  arrayList 首先复制Colections加  : 创建arrayList ar =new arrayList(); ArrayList具体提供的功能:属性            ...

  6. Java 集合 ArrayList和LinkedList的几种循环遍历方式及性能对比分析 [ 转载 ]

    Java 集合 ArrayList和LinkedList的几种循环遍历方式及性能对比分析 @author Trinea 原文链接:http://www.trinea.cn/android/arrayl ...

  7. 数组Array和列表集合ArrayList、LinkedList和Vector的区别

    一.ArrayList和Vector的区别 ArrayList与Vector主要从以下方面来说. 1.同步性: Vector是线程安全的,也就是说是同步的,而ArrayList是线程序不安全的,不是同 ...

  8. 第三章泛型集合ArrayList 和Hashtable

    第三章泛型集集合 ArrayList 变量名 = new ArrayList();  //相当与一个容器 他的执行using 是  using System.Collections; 变量名.ADD( ...

  9. JAVA基础——集合——ArrayList

    ArrayList集合 ArrayList的一些方法(JDK1.8): 将指定的元素附加到列表的末尾,true:添加成功,false:添加失败: public boolean add(E e)    ...

随机推荐

  1. ios fixed属性bug解决方法

    在内容层外面包一个div 加上样式:position:fixed;top:0px; bottom:50px;overflow:scroll; 就可以完美解决

  2. phaser源码解析(三) Phaser.Utils类下isPlainObject方法

    /** * #这是一个对jQuery.isPlainObject(obj)稍加修改的方法. 一个 普通对象 obj.toString() => "[object Object]&quo ...

  3. leetcode169——Majority Element (C++)

    Given an array of size n, find the majority element. The majority element is the element that appear ...

  4. 修复Windows7的便签问题

    工作的时候,喜欢利用Windows的附件“便签”,将自己要做的事情一一列在上面,显示在桌面上, 今天突然发现便签损坏,系统是元数据损坏,后来在网上查到解决方法,特此记录: 1. 以管理员身份运行 cm ...

  5. 【转】主从同步出现一下错误:Slave_IO_Running: Connecting

    主从同步出现一下错误: Slave_IO_Running: ConnectingSlave_SQL_Running: Yes 解决方法: 导致lave_IO_Running 为connecting 的 ...

  6. docker 中搭建tomcat

    关于docker中tomcat的搭建,没有什么多说的,直接下载官方镜像 docker pull tomcat  (可能会下载到好几个镜像,就是tag不同,有知道为什么的可以告诉我) 然后我看的  ht ...

  7. WebStorm快捷键收集

    1.webstorm快捷键: IntelliJ-Idea 的快捷键 Ctrl+/ 或 Ctrl+Shift+/ 注释(// 或者/*…*/ ) Shift+F6 重构-重命名 Ctrl+X 删除行 C ...

  8. 那些所谓过滤掉iOS菜鸟的面试题

    一.struct和class的区别<swfit里的array是什么类型,在大量复制时会不会有性能问题.> class是引用类型,struct是值类型 class可以继承类.接口和被继承,s ...

  9. Wap站总结一

    前段时间负责了公司的wap站前端工作,目前wap站的基础及较为复杂的几张页面都已经出来,现根据自己的一些经验,贴出部分心得,希望对现在或者以后可能会接触到Wap站的一些人有些帮助 一.本次WAP网站的 ...

  10. 转:Redis Geo: Redis新增位置查询功能

    原文来自于:http://www.infoq.com/cn/news/2015/07/redis-geo 移动互联网增进了人与人之间的联系,其中基于位置信息的服务(Location Based Ser ...