how would I output to a file two variables but one on each line I have done this but it puts one right beside the other...
Code:char hi; char bye; hi = 'h'; bye = 'b'; ofstream file("file.txt"); file<<hi; file<<" "; file<<bye; file.close();
how would I output to a file two variables but one on each line I have done this but it puts one right beside the other...
Code:char hi; char bye; hi = 'h'; bye = 'b'; ofstream file("file.txt"); file<<hi; file<<" "; file<<bye; file.close();
Instead of
file << hi;
file << " ";
file << bye;
Do this:
file << hi;
file << '\n'
file << bye;
It should work now I hope.
What will people say if they hear that I'm a Jesus freak?
What will people do if they find that it's true?
I don't really care if they label me a Jesus freak, there is no disguising the truth!
Jesus Freak, D.C. Talk
-gnu-ehacks