摘要:
容器的iterator类型vector::iterator iter;迭代器是一种检查容器内元素并遍历元素的数据类型。begin和end操作vector vec;vector::iterator iter = vec.begin(); //若vec不为空,则iter指向ive... 阅读全文
posted @ 2015-10-02 00:16
mlhy
阅读(76)
评论(0)
推荐(0)
摘要:
标准库vector类型#includeusing std::vector;vector为一个类模板。vector的初始化vector v1; vector v2(v1); v2是v1的一个副本vector v3(n,i); v3包含n个值为i的元素v... 阅读全文
posted @ 2015-10-02 00:16
mlhy
阅读(97)
评论(0)
推荐(0)
摘要:
标准库string类型string对象初始化string s1;string s2(s1);string s3("value");string s4(n,'c');string对象的读写string s;cin>>s; //读取并忽略开头的所有... 阅读全文
posted @ 2015-10-02 00:15
mlhy
阅读(98)
评论(0)
推荐(0)
摘要:
声明与定义声音与定义的区别在于,声明没有给变量分配空间,而定义则给变量分配了空间;定义也是声明。extern int i; // 声明但未定义int i ; //声明且定义extern double PI = 3.14; //声明且定义文件用于声明而不是定义。之所以这样的原因是有时... 阅读全文
posted @ 2015-10-02 00:15
mlhy
阅读(148)
评论(0)
推荐(0)

浙公网安备 33010602011771号