chapter2-23.cpp

来自「STL程序员开发指南源码」· C++ 代码 · 共 18 行

CPP
18
字号
//文件名:CHAPTER2-23.cpp
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
int main() 
{   
  string s(10u, ' ');           // Create a string of ten blanks.
  const char* A = "this is a test";
  s += A;
  cout << "s = " << (s + '\n');
  cout << "As a null-terminated sequence: " << s.c_str() << endl;
  cout << "The sixteenth character is " << s[15] << endl;
  reverse(s.begin(), s.end());
  cout << s<<endl;
  return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?