📄 chapter2-24.cpp
字号:
//文件名:CHAPTER2-24.cpp
#include<string>
#include <iostream>
using namespace std;
int main()
{
string test;
while(test.empty() || test.size() <= 5)
{
cout << "Type a string between 5 and 100 characters long. "
<< endl;
cin >> test;
}
cout << "Changing the third character from " << test[2] << " to * " << endl;
test[2] = '*';
cout << "now its: " << test << endl << endl;
cout << "Identifying the middle: ";
test.insert(test.size() / 2, "(the middle is here!)");
cout << test << endl << endl;
cout << "I didn't like the word 'middle',so instead,I'll say:"<< endl;
test.replace(test.find("middle",0), 6, "center");
cout << test << endl;
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -