so if I have a simple interactive program like this:
#include <iostream>
#include <sstream>
#include <string>
#include <cstring>
#define cout os
int main() {
stringstream os;
cout << "If you would like to continue, type 'Continue'" << '\n';
string line;
while (cin >> line) {
if (line == "Continue") {
cout << "If you would like to continue, type 'Continue'" << '\n';
}
else { break; }
}
cout << "Program ended." << '\n';
cout << os.str();
return 0;
}
How do I make it such that I am able to include my directive "#define" so that all the lines printed to standard output will be printed at the end of the program by cout << os.str(), when by doing so it also will be making the final "cout" into an "os"? I have tried using printf instead with the os at the end and have been having trouble/compiler errors saying "no matching function call to printf."
I hope my question makes sense and apologize if this has been asked already but I have been unable to find it on here.