📄 chapter2-18.cpp
字号:
//文件名:CHAPTER2-18.cpp
#include <iostream>
#include <string>
using namespace std;
void main()
{
string TestString = "1111122222333334444455555";
//采用length()返回字符串长度
cout << TestString << "\n size: " << TestString.length() << endl;
TestString.resize(5);
//采用size()返回字符串长度
cout << TestString << "\n size: " << TestString.size() << endl;
TestString.resize(10);
cout << TestString << "\n size: " << TestString.size() << endl;
TestString.resize(15,'6');
cout << TestString << "\n size: " << TestString.size() << endl;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -