第30451题 单选题
有如下C++代码片段,执行后输出的结果是?
#include <iostream>
#include <string>
using namespace std;
int main() {
    string s = "hello,world!";
    s.erase(5, 1);
    s.append("hi");
    int pos = s.find("world");
    string res = s.substr(pos, 5);
    cout << res << endl;
    return 0;
}
A

world

B

world!

C

worldhi

D

ello,

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