All of your output seems to be going to a file.
Except for
cout<<line<<endl;
, that is.
I might be wrong, but I think if you do something like
1 2 3 4
|
ifstream infile;
ofstream outfile;
infile.open("computerprogrammin13.txt");
outfile.open("computerprogrammin13.txt");
|
where you open the same file like that,
outfile will clear out everything that's in the file.
Just tested with this:
1 2 3 4 5 6 7
|
#include <fstream>
int main()
{
std::ifstream blah("blah.txt");
std::ofstream blahy("blah.txt");
}
|
Before, I had a file named "blah.txt" containing a bunch of random junk.
After I ran this, blah.txt was empty, which seems to suggest that
blahy discarded everything in the file.
(not sure if the results would be different with a different computer/compiler, though)
If that's the case, that would mean that your file, in effect, gets trashed when you open it like that, so your
cout statement would end up printing a blank string.
I would suggest making your input file different from your output file. (that's the easiest way to do it)