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

5 world

B

5 world!!!

C

3 world

D

8 world!!!

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