Is it possible to output data on more than one line or is it mandatory that each niew line of text be accompanied by a cout << statement. Thanks
Is it possible to output data on more than one line or is it mandatory that each niew line of text be accompanied by a cout << statement. Thanks
Do you mean -
orCode:#include <iostream> using namespace std; int main ( ) { cout << "This sentence" " is on" " more than one" " line."; return 0; }
?Code:#include <iostream> using namespace std; int main ( ) { cout << "This sentence\nis on\nmore than one\nline."; return 0; }
#include <iostream.h>
void main()
{
cout << "Hello "
"this is perfectly "
"alright";
cout << "\nSo"
<< "is"
<< "this";
}
oh so you can have more that one string on cout......interesting I wonders why books don't touch on this.
There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!
"...The only real game I thank in the world is baseball..." --Babe Ruth
"Life is beautiful"-Don Corleone right before he died.
"The expert on anything was once a beginner" -Baseball poster I own.
Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.
Thanks for the information there-even though it was not my question! I have 'removed' lots of cout << from my latest program code.....I never knew that...................used lots of \n but not the other way you described. Thanx
Such is life.
Most books do tell you how to do this...Although it isn't very useful. You can just do this:
cout << "hello" << " my" << " friend";
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