⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chapter2-24.cpp

📁 C++STL程序员开发指南
💻 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 + -