C#基础总结之四List-Hashtable-冒泡排序

            #region  第四天作业 名片--------ArrayList
            //ArrayList card = new ArrayList();
            //card.Add("220211100112209803");
            //card.Add("13618390284");
            //card.Add("男");
            //card.Add("小胖");
            //card.Add("178cm");
            //card.Add("20");
            //card.Add("200kg");
            //for (int i = 0; i < card.Count; i++)
            //{
            //    string name = string.Empty;
            //    Console.WriteLine("请输入您要查找的人名");
            //    name = Console.ReadLine();
            //    if (card.Contains(name))  //== true
            //    {
            //        Console.WriteLine(@"身份证号:{0},电话号码:{1},性别:{2},姓名:{3},身高:{4},年龄:{5},体重:{6}",
            //            card[0], card[1], card[2], card[3], card[4], card[5], card[6]);
            //        Console.ReadLine();
            //    }
            //    else
            //    {
            //        Console.WriteLine("对不起,没有您要找的人!");
            //        Console.WriteLine(" ");
            //    }

            //}
            /////另一种方法
            //ArrayList Card = new ArrayList();
            //Card.Add(new ArrayList() { "220211100112209803", "13618390284", "男", "小胖", "178cm", "20", "200kg" });
            //Card.Add(new ArrayList() { "220211100112209803", "13618390284", "男", "石瑀", "178cm", "20", "200kg" });
            //Card.Add(new ArrayList() { "220211100112209803", "13618390284", "男", "张三", "178cm", "20", "200kg" });
            //Card.Add(new ArrayList() { "220211100112209803", "13618390284", "男", "李四", "178cm", "20", "200kg" });
            //Card.Add(new ArrayList() { "220211100112209803", "13618390284", "男", "李五", "178cm", "20", "200kg" });
            //Card.Add(new ArrayList() { "220211100112209803", "13618390284", "男", "李六", "178cm", "20", "200kg" });
            //string name = string.Empty;
            //Console.WriteLine("请输入您要查找的人名");
            //name = Console.ReadLine();
            //for (int i = 0; i < Card.Count; i++)
            //{
            //    ArrayList card = (ArrayList)Card[i];
            //    if (card.Contains(name) == true)
            //    {
            //        Console.WriteLine(@"身份证号:{0},电话号码:{1},性别:{2},姓名:{3},身高:{4},年龄:{5},体重:{6}",
            //            card[0], card[1], card[2], card[3], card[4], card[5], card[6]);
            //        Console.ReadLine();
            //    }
            //    else
            //    {
            //        continue;
            //    }
            //    if (i == Card.Count - 1)
            //    {
            //        Console.WriteLine("对不起,没有您要找的人!");
            //        Console.ReadLine();
            //    }             
            //}
            #endregion

            #region  第四天作业 名片--------List<>
            //List<string> arrList = new List<string>();
            //arrList.Add("220211100112209803");
            //arrList.Add("13618390284");
            //arrList.Add("男");
            //arrList.Add("小胖");
            //arrList.Add("178cm");
            //arrList.Add("20");
            //arrList.Add("200kg");
            //for (int i = 0; i < arrList.Count; i++)
            //{
            //    string name = string.Empty;
            //    Console.WriteLine("请输入您要查找的人名");
            //    name = Console.ReadLine();
            //    if (arrList.Contains(name) == true)
            //    {
            //        Console.WriteLine(@"身份证号:{0},电话号码:{1},性别:{2},姓名:{3},身高:{4},年龄:{5},体重:{6}",
            //            arrList[0], arrList[1], arrList[2], arrList[3], arrList[4], arrList[5], arrList[6]);
            //        Console.ReadLine();
            //    }
            //    else
            //    {
            //        Console.WriteLine("对不起,没有您要找的人!");
            //        Console.WriteLine(" ");
            //    }
            //}
            #endregion
            
            #region  第四天作业 冒泡排序
            //List<int> number = new List<int>();
            //number.Add(1);
            //number.Add(4);
            //number.Add(7);
            //number.Add(2);
            //for (int i = 0; i < number.Count - 1; i++)
            //{
            //    for (int j = 0; j < number.Count - 1 - i; j++)
            //    {
            //        if (number[j] > number[j + 1])
            //        {
            //            int num = number[j];
            //            number[j] = number[j + 1];
            //            number[j + 1] = num;
            //        }
            //    }
            //}
            //for (int i = 0; i < number.Count; i++)
            //{
            //    Console.WriteLine(number[i]);
            //}
            //Console.ReadKey();
            #endregion

            #region  Hashtable 集合
            //Hashtable hashtable1 = new Hashtable();   //集合  k必须值唯一,添加重复时,不执行,不报错 //打出是无序性的.k值唯一                                               
            //hashtable1.Add("1", 2);  
            //hashtable1.Add(1, 2);    //前面为K值,后面是value值   k值可以使用int或string,value也可以为数组

            ////Hashtable方法及举例
            ////定义
            //string[] arsString = new string[3];
            //arsString[0] = "123";
            //arsString[0] = "aaa";
            //arsString[0] = "bbb";
            //Hashtable hashtable2 = new Hashtable();   //集合  k必须值唯一
            //hashtable1.Add("1", 2);
            //hashtable1.Add("2", arsString);  //可以放数组
            //hashtable1.Add("3", "444");
            #endregion

 

 本系列教程:

C#基础总结之八面向对象知识点总结-继承与多态-接口-http://www.cnblogs.com/spring_wang/p/6113531.html

C#基础总结之七面向对象知识点总结1http://www.cnblogs.com/spring_wang/p/6113526.html

C#基础总结之六 DataTable (临时表/数据源) 和Datatable 名片练习http://www.cnblogs.com/spring_wang/p/6113520.html

C#基础总结之五Dictionary<string, string[]>和while循环http://www.cnblogs.com/spring_wang/p/6113514.html

C#基础总结之四List-Hashtable-冒泡排序http://www.cnblogs.com/spring_wang/p/6113504.html

C#基础总结之三循环控制-for-数组-乘法表-arraylisthttp://www.cnblogs.com/spring_wang/p/6113496.html

C#基础总结之二循环控制-运算符http://www.cnblogs.com/spring_wang/p/6113484.html

C#基础总结之一变量常量-if嵌套语句-witch结构-类型转换http://www.cnblogs.com/spring_wang/p/6113476.html

C#基础课程之六(临时表)DataTable使用方法http://www.cnblogs.com/spring_wang/p/6113454.html

C#基础课程之五集合(HashTable,Dictionary)http://www.cnblogs.com/spring_wang/p/6113404.html

C#基础课程之四集合(ArrayList、List<泛型>)http://www.cnblogs.com/spring_wang/p/6113396.html

C#基础课程之三循环语句http://www.cnblogs.com/spring_wang/p/6113383.html

C#基础课程之二变量常量及流程控制http://www.cnblogs.com/spring_wang/p/6113372.html

C#基础课程之一注释和控制台、一些常识http://www.cnblogs.com/spring_wang/p/6113361.html

C#基础第九天-作业答案-储蓄账户(SavingAccount)和信用账户(CreditAccount) http://www.cnblogs.com/spring_wang/p/6113291.html

C#基础第九天-作业-储蓄账户(SavingAccount)和信用账户(CreditAccount) http://www.cnblogs.com/spring_wang/p/6113285.html

C#基础第八天-作业答案-设计类-面向对象方式实现两个帐户之间转账http://www.cnblogs.com/spring_wang/p/6113274.html

C#基础第八天-作业-设计类-面向对象方式实现两个帐户之间转账http://www.cnblogs.com/spring_wang/p/6113258.html

C#基础第七天-作业答案-利用面向对象的思想去实现名片-动态添加http://www.cnblogs.com/spring_wang/p/6113232.html

C#基础第七天-作业-利用面向对象的思想去实现名片-动态添加http://www.cnblogs.com/spring_wang/p/6113224.html

C#基础第六天-作业-利用面向对象的思想去实现名片http://www.cnblogs.com/spring_wang/p/6113028.html

C#基础第六天-作业答案-利用面向对象的思想去实现名片http://www.cnblogs.com/spring_wang/p/6113033.html

C#基础第五天-作业答案-用DataTable制作名片集http://www.cnblogs.com/spring_wang/p/6113022.html

C#基础第五天-作业-用DataTable制作名片集http://www.cnblogs.com/spring_wang/p/6113013.html

C#基础第四天-作业答案-Hashtable-list<KeyValuePair>泛型实现名片http://www.cnblogs.com/spring_wang/p/6113005.html

C#基础第四天-作业-Hashtable-list<KeyValuePair>泛型实现名片http://www.cnblogs.com/spring_wang/p/6113000.html

C#基础第三天-作业答案-集合-冒泡排序-模拟名片http://www.cnblogs.com/spring_wang/p/6112888.html

C#基础第三天-作业-集合-冒泡排序-模拟名片http://www.cnblogs.com/spring_wang/p/6112885.html

C#基础第二天-作业答案-九九乘法表-打印星星http://www.cnblogs.com/spring_wang/p/6112881.html

C#基础第二天-作业-九九乘法表-打印星星http://www.cnblogs.com/spring_wang/p/6112875.html

C#基础第一天-作业答案http://www.cnblogs.com/spring_wang/p/6112872.html

C#基础第一天-作业http://www.cnblogs.com/spring_wang/p/6112867.html

C#-string.Format对C#字符串格式化http://www.cnblogs.com/spring_wang/p/6077098.html

posted @ 2016-11-29 14:29  王春天  阅读(2082)  评论(0编辑  收藏  举报
云推荐