GESP四级模拟1-T9
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
题目内容:小李想要用文件重定向将程序中的部分输出写入到 record.txt 文件中,那么下面横线上应填写( )。
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main() {
ofstream record_file("record.txt");
streambuf* original_cout = cout.rdbuf();
cout.rdbuf(record_file.rdbuf());
___________________________________ // 在此处填入代码
cout.rdbuf(original_cout); // 恢复原始的标准输出缓冲区
return 0;
}
A. cout << "This text will be written to the record file." << endl;
B. record_file << "This text will be written to the record file." << endl;
C. cout >> "This text will be written to the record file." >> endl;
D. record_file >> "This text will be written to the record file." >> endl;
2025-5 GESP4级模拟赛---挖土机R50周赛(语法场)---选择判断题
- 状态
- 已结束
- 规则
- OI
- 题目
- 25
- 开始于
- 2025-5-17 10:00
- 结束于
- 2025-5-19 0:00
- 持续时间
- 1 小时
- 主持人
- 参赛人数
- 48