📄 strdemo.cpp
字号:
#include <iostream>
#include <string>
using namespace std;
// illustrates string member functions length() and substr()
int main()
{
string s;
cout << "enter string: ";
cin >> s;
int len = s.length();
cout << s << " has " << len << " characters" << endl;
cout << "first char is " << s.substr(0, 1) << endl;
cout << "last char is " << s.substr(s.length()-1, 1) << endl;
cout << endl << "all but first is " << s.substr(1,s.length()) << endl;
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -