Question: Object-Oriented Programming C++ - I have to output my program to a file called sim.txt. My simulation is a function obviously so I'm not able
Object-Oriented Programming C++ - I have to output my program to a file called "sim.txt". My simulation is a function obviously so I'm not able to do a thing like:
std::ofstream outputFile;
outputFile.open("sim.txt", std::ios::out);
outputFile << runSimulation(franchises, days);
outputFile.close();
Because I then get the error that is that the operator << does not recognize an ofstream to a void function. runSimulation also has another print function nested within it called printRundown that runSimulation calls once per day.
Signatures for printRundown and runSimulation:
void runSimulation(std::vector
void printRundown(const std::vector
I'd prefer you to overload the operator << to make it happen, but if there is a way that you know of that is easier then please do go with that. I'm having a hard time figuring this problem out. Thanks
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
