Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 &franchises, int days);

void printRundown(const std::vector &franchises);

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions

Question

a. Describe the encounter. What made it intercultural?

Answered: 1 week ago