集合,ArrayList
用集合代替数组:
Console.Write("请输入人数:");
int renshu = int.Parse(Console.ReadLine());
ArrayList chengji = new ArrayList();
if (renshu >= )
{
for (int h = ; h <= renshu; h++)
{
Console.Write("请输入第" + h + "个人成绩");
chengji.Add(int.Parse(Console.ReadLine()));
}
chengji.Sort();
foreach (int a in chengji)
{
Console.Write(a+" ");
} int he = ;
for (int i = ; i <= renshu - ; i++)
{
he = he + (int)chengji[i];
}
double pj = (he - (int)chengji[] - (int)chengji[] - (int)chengji[renshu - ] -(int)chengji[renshu - ] / (renshu - ));
Console.Write("去掉两个最低分"+chengji[]+","+chengji[]+"去掉两个最高分"+chengji[renshu - ]+","+chengji[renshu - ]+"最后的成绩是:"+pj); }
else
{
Console.WriteLine("您输入的人数要大于等于5!!!");
}
Console.ReadLine();
foreach查询多为数组:
???
集合,ArrayList的更多相关文章
- Java ArrayList和Vector、LinkedList与ArrayList、数组(Array)和列表集合(ArrayList)的区别
ArrayList和Vector的区别ArrayList与Vector主要从二方面来说. 一.同步性: Vector是线程安全的,也就是说是同步的,而ArrayList是线程序不安全的,不是同步 ...
- 集合ArrayList
/*集合ArrayList * 例如: * 1.创建:ArrayList<Egg> myList = new ArrayList<Egg>(); * Egg类型的集合 ...
- 面向对象之集合ArrayList
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using S ...
- 集合及特殊集合arrayList
1,运用集合 arrayList 首先复制Colections加 : 创建arrayList ar =new arrayList(); ArrayList具体提供的功能:属性 ...
- Java 集合 ArrayList和LinkedList的几种循环遍历方式及性能对比分析 [ 转载 ]
Java 集合 ArrayList和LinkedList的几种循环遍历方式及性能对比分析 @author Trinea 原文链接:http://www.trinea.cn/android/arrayl ...
- 数组Array和列表集合ArrayList、LinkedList和Vector的区别
一.ArrayList和Vector的区别 ArrayList与Vector主要从以下方面来说. 1.同步性: Vector是线程安全的,也就是说是同步的,而ArrayList是线程序不安全的,不是同 ...
- 第三章泛型集合ArrayList 和Hashtable
第三章泛型集集合 ArrayList 变量名 = new ArrayList(); //相当与一个容器 他的执行using 是 using System.Collections; 变量名.ADD( ...
- JAVA基础——集合——ArrayList
ArrayList集合 ArrayList的一些方法(JDK1.8): 将指定的元素附加到列表的末尾,true:添加成功,false:添加失败: public boolean add(E e) ...
- 反射方式,获取出集合ArrayList类的class文件对象
/* * 定义集合类,泛型String * 要求向集合中添加Integer类型 * * 反射方式,获取出集合ArrayList类的class文件对象 * 通过class文件对象,调用add方法 * * ...
- Java中list集合ArrayList 中contains包含的使用
Java中list集合ArrayList 中contains包含的使用 https://blog.csdn.net/qq_38556611/article/details/78774690
随机推荐
- IDC:时钟系统
ylbtech-IDC:时钟系统 主要应用于要求有统一时间进行生产,调度的单位如:电力,机场.轻轨.地铁.体育场馆.酒店.医院.部队.油田.水利工程等领域.大区域时钟系统主要由母钟和多台子钟构成. 1 ...
- Eclipse代码提示补全问题,自动选择第一个
原地址 http://blog.csdn.net/liuhhaiffeng/article/details/7179243 Eclipse具有代码提示功能, 但是默认的提示只有在输入".&q ...
- SEO之HTML代码优化
原文地址:http://www.admin5.com/article/20081128/117821.shtml 一.文档类型(DOCTYPE) XHTML1.0有三种DOCTYPE: 1.过渡型 ...
- 基于folly的AtomicIntrusiveLinkedList无锁队列进行简单封装的多生产多消费模型
1.基于folly的AtomicIntrusiveLinkedList略微修改的无锁队列代码: #ifndef FOLLY_REVISE_H #define FOLLY_REVISE_H namesp ...
- centos7 使用二进制安装mysql 5.7.23
1.下载二进制安装包 mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz cd /usr/local/src wget https://cdn.mysql.com// ...
- Unable to find the wrapper ”https” - did youforget to enable it when you configured PHP?
Unable to find the wrapper ”https” - did youforget to enable it when you configured PHP? 这是在Windows的 ...
- better-scroll高度问题
better-scroll无法滚动主要2方面原因,1)层级关系.2)高度问题
- linux下用命令修改文件内容
修改test_modify.sh中的LICENSE_INFO test_modify.sh #!/bin/bash licenseInfo=LICENSE_INFO licenseProduct=LI ...
- asp mvc 导出txt 文件泛型方法
asp mvc 导出txt 文件泛型方法分享: public static void ExportFile<T>(T obj) { StringBuilder str = new Stri ...
- angularjs探秘<五> 举足轻重的scope
scope在angular中的作用可谓举足轻重,不理解scope就不会angular: scope是应用在 HTML (view) 和 JavaScript (controller)之间的纽带. sc ...