You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
335 B

2 years ago
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int main() {
string x = "ABCDEFG";
cout << x.substr(0, 2) << endl; //从索引0开始截取2个长度
cout << x.substr(2) << endl; //从索引2开始截取到结尾
/*
:
AB
CDEFG
*/
return 0;
}