c++
DreamLee0625
这个作者很懒,什么都没留下…
展开
-
c++ const和指针*
左定值,右定向。 左定值:当const在的左侧时,指针所指向的值保持不变(或者说,不能通过指针来修改其所指向的值)。 右定向:当const在的右侧时,指针所指的方向保持不链。 例子 1-1 #include <iostream> using namespace std; int main(){ const char* str1; str1 = "mystr1"; ...原创 2019-10-28 10:45:13 · 548 阅读 · 0 评论 -
c++笔记 字符串/string比较
string对象的比较 1.直接使用==,相等返回1,不相等返回0; 2.使用string对象的compare方法,相等返回0,str1>str2返回1,str1<str返回-1; 例子: #include "string.h" #include "iostream.h" using namespace std; int main(){ string str1 = "aaa"...原创 2019-09-02 16:13:45 · 766 阅读 · 1 评论