2012年3月18日

STL中的map

摘要: 一。用数组来插入会覆盖: mapStudent[1] = “student_one”; mapStudent[1] = “student_two”;顺序执行后结果是:mapStudent[1] == “student_two”(覆盖了)。二。我们怎么知道当前已经插入了多少数据呢,可以用size函数三。用count函数来判定关键字(即中括号里的键)是否出现,count函数的返回值只有两个,要么是0,要么是1四。用find函数来定位数据出现位置,它返回的一个迭代器,当数据出现时,它返回数据所在位置的迭代器,如果map中没有要查找的数据,它返回的迭代器等于end函数返回的迭代器View Code # 阅读全文

posted @ 2012-03-18 21:31 [S*I]SImMon_WCG______* 阅读(831) 评论(0) 推荐(0) 编辑

prev_permutation与next_permutation

摘要: int main(){int a[] = {3,1,2};do{ cout << a[0] << " " << a[1] << " " << a[2] << endl;}while (next_permutation(a,a+3));return 0;}输出:312/321 因为原数列不是从最小字典排列开始。所以要想得到所有全排列int a[] = {3,1,2}; change to int a[] = {1,2,3};另外,库中另一函数prev_permutation与next_ 阅读全文

posted @ 2012-03-18 20:48 [S*I]SImMon_WCG______* 阅读(189) 评论(0) 推荐(0) 编辑

导航