第29566题 单选题
以下C++代码运行后输出的结果是?
#include <iostream>
#include <string>
using namespace std;
int main() {
    string s = "hello world";
    s.append("!");
    int pos = s.find("world");
    string sub = s.substr(pos, 5);
    cout << sub.size() << " " << sub << endl;
    return 0;
}
A

5 world

B

6 world

C

5 world!

D

6 world!

程序运行统计
暂无判题统计
提交0次 正确率0.00%
答案解析