随笔分类 -  c++学习笔记

摘要:由getline的定义可以知道, getline返回的是一个输入流, 正常情况下输入流都是正确的, 因而 是一个死循环无法跳出; Get line from stream into string Extracts characters from is and stores them into str 阅读全文
posted @ 2018-08-24 08:11 赖兴宇 阅读(4862) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 using namespace std; 4 int main(){ 5 char a[30] = "LaiXingYu", b[] = "LiuPeiWen", c[] = "LaiXingYu"; 6 cout<<"a: "<<a<<endl<<"b: "<<b<<"\nc: "<<c<<endl; 7 /... 阅读全文
posted @ 2018-05-17 22:03 赖兴宇 阅读(4005) 评论(0) 推荐(0)
摘要:在c++中,当申明变量int *p 的时,表示p是一个储存地址的变量;比如int *p=0,表示p指向地址为00000000的地址单元。当申明指针p之后,再用*p表示p指向的储存空间的内容;&表示取变量的地址; 下面用一些代码来解释*和&的关系; 申明一个int变量a,赋值为123; 通过&运算可以 阅读全文
posted @ 2018-05-14 19:33 赖兴宇 阅读(41297) 评论(3) 推荐(8)
摘要:Just like arrays, vectors use contiguous storage locations for their elements, which means that their elements can also be accessed using offsets on r 阅读全文
posted @ 2018-05-13 11:49 赖兴宇 阅读(6949) 评论(0) 推荐(0)