LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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


Reply
  Search this Thread
Old 09-14-2004, 02:23 PM   #1
webwolf70
Member
 
Registered: Feb 2004
Distribution: Windows XP. I gave up with Linux & I left LQ.
Posts: 502

Rep: Reputation: 30
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
 
Old 09-14-2004, 02:26 PM   #2
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
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!
 
Old 09-14-2004, 02:27 PM   #3
webwolf70
Member
 
Registered: Feb 2004
Distribution: Windows XP. I gave up with Linux & I left LQ.
Posts: 502

Original Poster
Rep: Reputation: 30
Thanks.



Webwolf
 
Old 09-14-2004, 02:28 PM   #4
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
 
Old 09-15-2004, 05:53 PM   #5
bcf2
Member
 
Registered: Nov 2003
Location: Nowhere and somewhere
Distribution: Mandrake 10
Posts: 124

Rep: Reputation: 15
\n is the newline character, and to save you further posts, to print backslash to the specified output, it's \\.
 
Old 09-18-2004, 04:30 PM   #6
webwolf70
Member
 
Registered: Feb 2004
Distribution: Windows XP. I gave up with Linux & I left LQ.
Posts: 502

Original Poster
Rep: Reputation: 30
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
 
Old 09-19-2004, 02:52 AM   #7
gr33ndata
Member
 
Registered: Aug 2003
Location: DMZ
Distribution: Ubuntu
Posts: 144

Rep: Reputation: 15
Try using printf and scanf instead of cout and cin, and for more info use "man <your-command>"
 
Old 09-19-2004, 02:58 AM   #8
mirradric
Member
 
Registered: May 2004
Location: Singapore
Distribution: Debian woody and debian sarge
Posts: 188

Rep: Reputation: 31
The guy's learning c++, no point in confusing him with c.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Editing Html's mickeyboa Fedora 2 07-19-2005 07:43 AM
FindWindow equivalent OneMan_aus Programming 3 09-21-2004 05:23 AM
dvdshrink equivalent mykrob Linux - Software 0 07-19-2004 06:48 AM
karamba equivalent DrOzz Linux - Software 8 08-14-2003 01:54 PM
equivalent to c? codename000 Programming 3 04-03-2003 11:08 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration