#include <iostream> #include <fstream> using namespace std; int main(){ char data[100]; ofstream out; string name; string _data; ifstream outfile; outfile.open("老师.txt"); outfile>>_data; cout<<_data<<endl; for(int i = 1;i<=10;i++){ name = "祝福老师"+to_string(i)+".txt"; out.open(name); cout<<"你想对老师说什么?"<<endl; cin.getline(data,100); out<<data<<endl; out.close(); } return 0; }
标签:std,文件,string,outfile,include,data From: https://www.cnblogs.com/wangyihang-xh/p/17808330.html