C++中输出字符到文本文档

 1 #include <iostream>
 2 #include <fstream>  //ofstream类的头文件
 3 using namespace std;
 4 int main()
 5 {
 6     int n;
 7     cin>>n;
 8     ofstream mycout("temp.txt");
 9     mycout<<n<<endl;
10     mycout.close();
11     return 0;
12 }

 

posted on 2017-03-08 14:02  Oliver-cs  阅读(4388)  评论(0编辑  收藏  举报

导航