入力ファイルの要素を使用しながら、関数で両方を行うことはできますか?結果を出力ファイルに同時に書き込むことはできますか?
while文の中は真ですか?
void solve(string inputFileName, string outputFileName)
{
//declaring variables
string filename = inputFileName;
//Open a stream for the input file
ifstream inputFile;
inputFile.open( filename.c_str(), ios_base::in );
//open a stream for output file
outputfile = outputFileName;
ofstream outputFile;
outputFile.open(outputfile.c_str(), ios_base::out);
while(!inputFile.eof())
{
inputFile >> number; //Read an integer from the file stream
outputFile << number*100 << "\n"
// do something
}
//close the input file stream
inputFile.close();
//close output file stream
outputFile.close();
}