摘要: 如果元组中只有一个元素,必须在后面多写一个逗号, 阅读全文
posted @ 2018-11-16 11:03 archerzon 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 5.9 1 #include <iostream> 2 using namespace std; 3 int main() 4 { 5 6 unsigned vowelCnt = 0, otherCnt = 0; 7 char ch; 8 while (cin >> ch) { 9 if (ch = 阅读全文
posted @ 2018-09-22 22:41 archerzon 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 移位运算符的优先级高于关系运算符、位运算符、赋值运算符和条件运算符。但是低于运算符。 阅读全文
posted @ 2018-09-15 16:55 archerzon 阅读(480) 评论(0) 推荐(0) 编辑
摘要: 4.6 1 #include <iostream> 2 using namespace std; 3 int main() 4 { 5 cout << "Enter one number: " << endl; 6 int checkNum; 7 while (cin>>checkNum){ 8 i 阅读全文
posted @ 2018-09-13 21:16 archerzon 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 右值(rvalue,读作are-value) 左值(lvalue,读作ell-value) 当一个对象被用作右值的时候,用的是对象的值(内容);当对象被用作左值的时候,用的是对象的身份(在内存中的位置)。 阅读全文
posted @ 2018-09-10 22:05 archerzon 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 作用于一个运算对象的运算符是一元运算符,如取地址符&和解引用符*; 作用于两个运算对象的运算符是二元运算符,如相等运算符==和乘法运算符*。 阅读全文
posted @ 2018-09-10 21:54 archerzon 阅读(857) 评论(0) 推荐(0) 编辑
摘要: size_type在P79 decltype在P62 size_t:它是一个与机器相关的unsigned类型,其大小足以保证存储内存中对象的大小。 阅读全文
posted @ 2018-09-09 19:08 archerzon 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 可以使用字符串字面量来初始化string对象,任何出现字符串字面量的地方都可以用以空字符结束的字符数组来替代。 阅读全文
posted @ 2018-09-09 17:20 archerzon 阅读(512) 评论(0) 推荐(0) 编辑
摘要: string是类,是可变长的字符序列,是容器。 char是字符,是内置类型。 大小比较: string: 1 #include <iostream> 2 #include <string> 3 using namespace std; 4 int main() 5 { 6 string str1 = 阅读全文
posted @ 2018-09-09 15:41 archerzon 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 数组可以不指定维度,维度由初始值的数量决定。使用数组时,编译器一般会将其转换成指针。 阅读全文
posted @ 2018-09-08 09:56 archerzon 阅读(72) 评论(0) 推荐(0) 编辑