摘要: //特殊集合 //stack集合 干草堆 栈集合 //先进后出 一个个的取值 一个一个的赋值,按照顺序进行 //属性与方法 //.count 取集合内元素的个数 //.push() 将元素一个个推入集合中 //.pop() 将元素一个个弹出集合 //.clear() 清空集合 //定义方式 //首先 阅读全文
posted @ 2016-05-11 22:09 枫炎 阅读(302) 评论(0) 推荐(0) 编辑
摘要: Console.Write("请输入班级人数:"); int n = int.Parse(Console.ReadLine()); //定义集合 ArrayList al = new ArrayList(); double sum = 0; for (int i = 0... 阅读全文
posted @ 2016-05-11 21:59 枫炎 阅读(409) 评论(0) 推荐(0) 编辑
摘要: Console.Write("请输入班级人数:"); int n = Convert.ToInt32(Console.ReadLine()); ArrayList fenshu = new ArrayList(); double sum = 0; for (int i = 0; i < n;i++ ... 阅读全文
posted @ 2016-05-11 21:56 枫炎 阅读(217) 评论(0) 推荐(0) 编辑
摘要: //集合 //System.Collections 命名空间包含接口和类,这些接口和类定义的对象(如列表,队列,位数组,哈希表和字典等)集合 //常用的集合为ArrayList类,特殊集合一般用到 Queue,Stack,Hashtable集合 //集合与数组的区别 //1、集合不同于数组,是一组可 阅读全文
posted @ 2016-05-11 21:52 枫炎 阅读(181) 评论(0) 推荐(0) 编辑
摘要: //常用集合为Arraylist //集合不同于数组,是一组可变量的元素的组合 //集合与数组的区别 //Arraylist的接口 //数组 //定义一个集合,集合是一个类 //ArrayList 集合 一般是填充统一数据类型,从上往下执行 //ArrayList al = new ArrayLis 阅读全文
posted @ 2016-05-10 21:48 枫炎 阅读(160) 评论(0) 推荐(0) 编辑
摘要: string[,] wang = new string[,] { {"■","■","■","■","■","■","■"}, {" "," "," ","■"," "," "," "}, {" "," "," ","■"," & 阅读全文
posted @ 2016-05-10 21:42 枫炎 阅读(223) 评论(0) 推荐(0) 编辑
摘要: //定义二维数组 //int [,]数组名=new int【a,b】{}; //a表示有几个一维数组 //b表示每个一维数组种有几个元素 阅读全文
posted @ 2016-05-10 21:40 枫炎 阅读(169) 评论(0) 推荐(0) 编辑
摘要: Console.Write("请输入手机号的个数:"); int n = int.Parse(Console.ReadLine()); string []hao=new string[n]; for (int i = 0; i < hao.Length;i++ ) { ... 阅读全文
posted @ 2016-05-10 21:36 枫炎 阅读(297) 评论(0) 推荐(0) 编辑
摘要: for (; ; ) { Console.WriteLine("班长投票选举(1-5)"); Console.WriteLine("请选择你要投票的人:"); Console.WriteLine("1、张三"); Console.WriteLine("2、李四"); Console.WriteLin 阅读全文
posted @ 2016-05-10 21:34 枫炎 阅读(413) 评论(0) 推荐(0) 编辑
摘要: Console.Write("请输入班级人数:"); int n = int.Parse(Console.ReadLine()); double [] fenshu=new double[n]; double sum = 0; for (int i = 0; i < n;i++ ) ... 阅读全文
posted @ 2016-05-10 21:33 枫炎 阅读(2312) 评论(0) 推荐(0) 编辑