摘要: 容器的iterator类型vector::iterator iter;迭代器是一种检查容器内元素并遍历元素的数据类型。begin和end操作vector vec;vector::iterator iter = vec.begin(); //若vec不为空,则iter指向ive... 阅读全文
posted @ 2015-10-02 00:16 mlhy 阅读(68) 评论(0) 推荐(0) 编辑
摘要: 数组数组是类似于vector的低级复合类型。现代C++程序应尽量使用vector类型,只有强调速度时才使用数组。动态数组创建T *pt = new T[size];多维数组int ia[3][4] = { {0,1,2,3}, {4,5,6,7}, {8,9,10,... 阅读全文
posted @ 2015-10-02 00:16 mlhy 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 声明与定义声音与定义的区别在于,声明没有给变量分配空间,而定义则给变量分配了空间;定义也是声明。extern int i; // 声明但未定义int i ; //声明且定义extern double PI = 3.14; //声明且定义文件用于声明而不是定义。之所以这样的原因是有时... 阅读全文
posted @ 2015-10-02 00:15 mlhy 阅读(135) 评论(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 阅读(86) 评论(0) 推荐(0) 编辑
摘要: try..except…finallytry: codeexcept error as e: codeelse: code #没有错误时执行finally: code #不管有没有错误都执行code #正常抛出错误用raise关键字将错误... 阅读全文
posted @ 2015-09-12 23:20 mlhy 阅读(150) 评论(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-09-12 23:15 mlhy 阅读(88) 评论(0) 推荐(0) 编辑
摘要: 容器的iterator类型vector::iterator iter;迭代器是一种检查容器内元素并遍历元素的数据类型。begin和end操作vector vec;vector::iterator iter = vec.begin(); //若vec不为空,则iter指向ive... 阅读全文
posted @ 2015-09-12 23:15 mlhy 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 标准库string类型string对象初始化string s1;string s2(s1);string s3("value");string s4(n,'c');string对象的读写string s;cin>>s; //读取并忽略开头的所有... 阅读全文
posted @ 2015-09-12 23:14 mlhy 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 声明与定义声音与定义的区别在于,声明没有给变量分配空间,而定义则给变量分配了空间;定义也是声明。extern int i; // 声明但未定义int i ; //声明且定义extern double PI = 3.14; //声明且定义文件用于声明而不是定义。之所以这样的原因是有时... 阅读全文
posted @ 2015-09-12 23:13 mlhy 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 由于Chromium浏览器,打字的时候经常会跳字母,所以就换了firefox浏览器,但是FF上网的时候特别慢,而且大部分时间是花费在解析域名上。因此到网上找了许多资料,最终解决方法如下。 1.安装dnsmasq软件,用于解析dnspacman -S dnsmasq2.编辑dnsmas... 阅读全文
posted @ 2015-09-12 23:11 mlhy 阅读(121) 评论(0) 推荐(0) 编辑