main.cpp
来自「C++STL课本中的源程序代码己经验证过了可以通过编译和运行。」· C++ 代码 · 共 17 行
CPP
17 行
#include <fstream>
#include <iostream>
using namespace std;
int main(void){
ofstream wFileStream;
wFileStream.open("d:\\水果.txt", ios::out|ios::app);
if(!wFileStream){
cout << "打开文件失败" << endl;
return 1;
}
wFileStream << "apple" << ' ' << "苹果" << endl;
wFileStream << "banana" << ' ' << "香蕉" << endl;
wFileStream << "grape" << ' ' << "葡萄" << endl;
wFileStream.close();
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?