0
首先,它不是一个家庭作业问题。我知道如何读取和写入文件,在C++中解析行,如果我已经知道所涉及的文件的名称,但我需要为输入和输出的不同文件名运行相同的代码,并且会多次调用它。任何帮助将不胜感激:)编写可执行程序program.exe来读取和写入文件,但以这种方式program.exe <input.txt> output.txt
#include <iostream>
#include <fstream>
#include <math.h>
#include <sstream>
#include <string>
using namespace std;
void file_reader(ifstream &file_read, ofstream &file_out){}
int main(){
ifstream file_read("temp.lmps",ios::in);
ofstream file_out("data.lmps",ios::out);
file_reader(file_read,file_out);
return 0;
}