69,371
社区成员
发帖
与我相关
我的任务
分享
#include<iostream>
#include <fstream>
#include <string>
using namespace std;
int main(int argc,char *args[])
{
string name;
name = args[1];
ifstream fin(name.c_str());
ofstream fout("test.txt");
fout<<"**********************"<<name<<"******************"<<endl;
fout<<"1 ";
int i=1;
string str;
while(!fin.eof())
{
getline(fin,str);
fout<<++i<<" "<<str<<endl;
}
return 0;
}