1.输入班级人数,统计每个人的姓名,性别,年龄:集合与数组 //Console.Write("请输入班级人数:"); //int a = int.Parse(Console.ReadLine()); //ArrayList al = new ArrayList(); //for (int i = 0; i < a;i++ ) //{ // string [] name =new string[3]; // Console.Write("请输入第{0}个人的姓名:&quo
引用 最近总有种感觉,自己复习的进度总被项目中的问题给耽搁了,项目中遇到的问题,不总结又不行,只能将复习基础方面的东西放后再放后.一直没研究过太深奥的东西,过去一年一直在基础上打转,写代码,反编译,不停的重复.一直相信,在你不知道要干嘛的时候,浮躁的时候,不如回到最基础的东西上,或许换种思考方式,会有不一样的收获. 泛型集合List<T>排序 先看一个简单的例子,int类型的集合: using System; using System.Collections.Generic; using Sy
求集合里元素的个数 输出最大的个数是多少 Sample Input41 23 45 61 641 23 45 67 8 Sample Output42 # include <iostream> # include <cstdio> # include <cstring> # include <algorithm> # include <cmath> # include <queue> # define LL long long usi
// 有一个集合,判断集合里有没有“world”这个元素,如果有,添加“javaee” List list = new ArrayList(); list.add("world"); list.add("java"); list.add("hello"); //ConcurrentModificationException /*Iterator it = list.iterator(); while(it.hasNext()){ String s
好吧,三年了,又重拾我的博客了,是因为啥呢,哈哈哈.今天被问到一个题目,当场答不出来,动手动的少了,再此记录下来. Q:有一个MyObject类型的List,MyObject定义如下: class MyObject{ public int age; public String name; public MyObject(int age,String name){ this.age = age; this.name = name; } @Override public String toStrin
给容器里元素排序时,会破坏容器的const的属性:因此当你在一个函数传参的时候如果使用的是const T&:那么你在调用qt的qsort给容器排序的时候可能会遭遇一些看不懂的BUG提示 类似: error C2678: binary '=' : no operator found which takes a left-hand operand of type 'const ShapeRectInfo' (or there is no acceptable conversion)