#include <iostream> #include <fstream> using namespace std; int main(int argc, char** argv) { // char data[100]; // ofstream out; // out.open("lll.txt"); // cin.getline(data,100); // out<<data<<endl; // out.close(); // // ifstream in; // in.open("lll.txt"); // in>>data; // in.close(); // cout<<data; char data[100]; ofstream on; ifstream in; cin.getline(data,100); for(int i=0;i<10;i++){ on.open("lll"+to_string(i)+".txt",ios::trunc); on<<data<<endl; on.close(); in.open("lll"+to_string(i)+".txt"); in>>data; in.close(); cout<<data<<endl; } return 0; }
标签:文件,cout,int,代码,char,close,data,out From: https://www.cnblogs.com/wangyueshuo/p/17808322.html