----------字符串string
文章平均质量分 54
寂寂寂寂寂蝶丶
这个作者很懒,什么都没留下…
展开
-
字符串string中“\0“与‘\0‘的打印、拼接问题
1."\0"为字符串长度为0的字符串指针,它与""等价2.打印"\0"与'\0'相同,cout输出时都会显示为空'\0'在string的初始化和拼接中size大小的不同 string s1 = "aaa\0bbb"; cout << s1.size() << endl; //3 cout << s1 << endl; //aaa cout << s1[3] << endl; //结尾为\0打印空原创 2021-04-15 19:38:21 · 3095 阅读 · 1 评论 -
string的初始化及相关属性
string的初始化及相关属性转载 2017-12-01 10:21:24 · 362 阅读 · 0 评论 -
string中成员函数的相关用法
string中成员函数的相关用法#include "stdafx.h"#include using namespace std;#include //string 不是关键字 而是一个类int _tmain(int argc, _TCHAR* argv[]){ string s = "china"; string s2 = "is great"; s += s2;/转载 2017-12-01 10:21:56 · 244 阅读 · 0 评论 -
读入一个包含标点符号的字符串,将标点符号去除后输出字符串剩余的部分
读入一个包含标点符号的字符串,将标点符号去除后输出字符串剩余的部分#include "stdafx.h"#include <iostream>#include <string>using namespace std;int _tmain(int argc, _TCHAR* argv[]){ string s; cout << "请输入一段字符...原创 2018-03-23 19:58:30 · 1540 阅读 · 0 评论 -
自实现string类的功能
自实现string类的功能主函数#include "stdafx.h"#include <iostream>using namespace std;#include "String.h"int _tmain(int argc, _TCHAR* argv[]){ String s; cout << s.c_str() << en...原创 2017-12-02 09:58:26 · 286 阅读 · 0 评论