假设文件能够正常打开,下面程序会把 Welcome 写入 log.txt。
Welcome
log.txt
int main() { ofstream fout("log.txt"); fout << "Welcome"; fout.close(); return 0; }
正确 √
错误 ×