Exactly how would I produce a .txt file of everything my program showed? But I want it to print out everything, even if I type something in.... Any suggestions?
Say
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <iostream>
usingnamespace std;
main()
{
int b;
int c;
int x;
cout << "Output 1\n\a";
cin >> b;
cin >> c;
cin >> x;
cout << "Weee that did nothing" << "\n" << "\n";
I think for that you should wrint your own stream or something like that.
If you want something easier you could create just a simple class and overload the << and >> operators so that it will be able to print both on the console and on a file
It's always possible to do this from the command line: program >output.txt
User input is a different story. It's input, so of course it won't go to the standard output. If you need to know what the user entered, you'll have to print it back immediately afterwards.