![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
文章平均质量分 61
S_O_Q
这个作者很懒,什么都没留下…
展开
-
set:: get_allocator
功能:返回一个构造该set容器的allocator 的一个副本。用法:Allocator get_allocator() const;说明:容器set的allocator 指明一个类的存储管理。默认的allocator能提供STL容器高效的运行。函数返回值:返回该容器的allocator 。//用ctr的 allocator 来创建ctr原创 2012-02-21 13:45:07 · 662 阅读 · 0 评论 -
几个简单但是不太常用的函数:cprintf, clrscr, strrev, cin.getline, strchr, strstr
几个简单但是不太常用的函数:cprintf 这个函数一般在 TC中使用。clrscr 只有在Turbo c 中可以运行 !在Turbo C++ 中,需要先另存为(save as).C格式,才能使用。 注:在VC中无法调用该函数,有下列办法: 1.#include windows.h> system("cls");原创 2012-04-23 17:23:08 · 1005 阅读 · 0 评论 -
error
set > s; 什么意思? 后面的 less 是什么意思?less 是保证set容器里面的元素师由小到大排列的,里面元素没有重复的。下面的程序主要是set的构造函数的练习。有错误。可不知道哪里错了。#include #include using namespace std;int main () { int ary[] = { 5,3,7,5,2,3,原创 2012-02-23 11:25:24 · 492 阅读 · 0 评论 -
set::vale_comp
功能:返回一个能确定元素的次序的函数语法:value_compare value_comp() const;说明:它是根据关键字的值key来确定元素的次序的。函数返回值:返回一个能确定元素的次序的函数#include #include using namespace std; int main()原创 2012-02-21 13:33:49 · 487 阅读 · 0 评论 -
set:: lower_bound
功能:求出指向第一个关键字的值是大于等于一个给定值的元素的定位器。语法:iterator lower_bound( const Key &_Key);const_iterator lower_bound( const Key &_Key) const;说明:_Key 是一个用于排序的关键字ex:#include原创 2012-02-20 14:48:30 · 2451 阅读 · 0 评论 -
set::max_size
功能:计算set容器的最大长度语法:size_type max_size() const;说明:max_size 会返回set容器的可能的最大长度。ex:#include#include using namespace std;#define len 5int main(){ set ctr; set::size_type st; in原创 2012-02-20 14:56:26 · 646 阅读 · 0 评论 -
set::key_comp
功能:取得一个比较对象的副本来对set容器中的元素排序、语法:key_compare key_comp() const;说明:存储对象定义了一个成员函数;bool operator(const Key &_Left, const Key _Right)当_Left 严格在 _Right 的前面时,返回true, 否则返回false。函原创 2012-02-20 14:22:50 · 780 阅读 · 0 评论 -
map, fstream, error
这个程序看不是很懂~~~#include #include #include using namespace std; int main () { typedef multimap M1; typedef M1::value_type v_t1; M1 m1; typedef multimap > M2; typedef M2::value_ty原创 2012-02-24 13:54:31 · 525 阅读 · 0 评论 -
template , for_each , fill
#include #include #include using namespace std; template class Print { public: void operator () (T& t) { cout << t << " "; } }; int main () {原创 2012-02-22 16:02:11 · 384 阅读 · 0 评论 -
set:: erase
set:: erase功能:将一个或一定范围的元素删除语法:iterator erase(iterator _Where)表示要删除元素的位置iterator erase(iterator _First, iterator _First)第一个被删除的元素的位置iterator erase(iterator _First, itera原创 2012-02-21 14:37:14 · 7663 阅读 · 1 评论 -
set::insert
#include #include using namespace std; void print (set >& s) { set >::iterator It; for ( It = s.begin(); It != s.end(); It++ ) cout << *It << " "; cout << endl; } int main () {原创 2012-02-23 11:45:27 · 3366 阅读 · 0 评论 -
vector_constructors
#include #include #include //#include using namespace std;int main(){ string str[] = {"Alex", "John", "Robert"}; vector v1; //empty vector object vector v2(10); //creates vector with 10 elem原创 2012-02-21 17:04:27 · 498 阅读 · 0 评论 -
set:: begin ,clear, count, empty, end, equal_range
set::beginconst_iterator begin() const;terator begin() ;功能:返回第一个元素的双向定位器(iterator)的地址。说明:当返回的第一个元素的地址值为一个常值定位器(_iterator),则set不会被修改。当返回的第一个元素的地址值为一个定位器(iterator),则set可被修改。原创 2012-02-21 14:25:10 · 1088 阅读 · 0 评论 -
数组名 vs 指针
ex:#include #include void test(char a[]){ a++; //ok printf(" second char is %c\n", a[0]);}void main() { char s[] = "abcde"; char *p = s; p += 2; //OK //s += 2; //error原创 2013-10-18 22:38:22 · 575 阅读 · 0 评论