Shezan said:
Not sure what you mean. Do you mean this?:
#include <iostream>
#include <fstream>
std::ifstream inputFile("input.txt");
std:
fstream outputFile("output.txt");
int main()
{
std::cout << "Files have been initialized outside main." <<
std::endl;
return 0;
}
Or maybe this
int main()
{
function1();
function2();
return 0;
}
void function1()
{
std::ifstream inputFile("input1.txt");
std:
fstream outputFile("output1.txt");
...
}
void function2()
{
std::ifstream inputFile("input2.txt");
std:
fstream outputFile("output2.txt");
...
}
Either way its a good idea when asking 'how do I ...' questions to post
the code you have already written. It's often easier to understand what
you want to do then. If you haven't already written some code, then it's
probably good for you to attempt to do so before asking the group.
john