Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
09-14-2004, 02:23 PM
|
#1
|
Member
Registered: Feb 2004
Distribution: Windows XP. I gave up with Linux & I left LQ.
Posts: 502
Rep:
|
What is the C++ equivalent to HTML's <br>?
If I where to type this:
cout << "Hello";
cout << "this is line two";
cout << "line three";
Then it will come out all on one line. How do I add a break inbetween cout's so it ends up on three different lines? Is there something for C++ that is like <br> in HTML?
Webwolf
|
|
|
09-14-2004, 02:26 PM
|
#2
|
LQ Guru
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,337
Rep:
|
I think it should be:
endl;
or
\n;
endl frees the buffer, while \n is a escape sequence. Here:
cout << "Hello\n";
or
cout << "Hello" << endl;
Check some tutorials for "Escape Sequences". There're plenty of them.
Regards!
|
|
|
09-14-2004, 02:27 PM
|
#3
|
Member
Registered: Feb 2004
Distribution: Windows XP. I gave up with Linux & I left LQ.
Posts: 502
Original Poster
Rep:
|
Thanks.
Webwolf
|
|
|
09-14-2004, 02:28 PM
|
#4
|
LQ Guru
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,337
Rep:
|
|
|
|
09-15-2004, 05:53 PM
|
#5
|
Member
Registered: Nov 2003
Location: Nowhere and somewhere
Distribution: Mandrake 10
Posts: 124
Rep:
|
\n is the newline character, and to save you further posts, to print backslash to the specified output, it's \\.
|
|
|
09-18-2004, 04:30 PM
|
#6
|
Member
Registered: Feb 2004
Distribution: Windows XP. I gave up with Linux & I left LQ.
Posts: 502
Original Poster
Rep:
|
Quote:
Originally posted by bcf2
\n is the newline character, and to save you further posts, to print backslash to the specified output, it's \\.
|
Thanks for the info. Every little bit helps right now, lol.
Webwolf
|
|
|
09-19-2004, 02:52 AM
|
#7
|
Member
Registered: Aug 2003
Location: DMZ
Distribution: Ubuntu
Posts: 144
Rep:
|
Try using printf and scanf instead of cout and cin, and for more info use "man <your-command>"
|
|
|
09-19-2004, 02:58 AM
|
#8
|
Member
Registered: May 2004
Location: Singapore
Distribution: Debian woody and debian sarge
Posts: 188
Rep:
|
The guy's learning c++, no point in confusing him with c.
|
|
|
All times are GMT -5. The time now is 12:36 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|