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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started