Formated Source Code

Reply

Join Date: May 2009
Posts: 10
Reputation: AbsoluteCPP is an unknown quantity at this point 
Solved Threads: 0
AbsoluteCPP AbsoluteCPP is offline Offline
Newbie Poster

Formated Source Code

 
0
  #1
Oct 2nd, 2009
Code View
In the linked page u can see that source code is properly formated, how to do that??

I am making my web, i want to know that how can i show the c++ source code on my web with proper format.

Q: How to show a formated source code on a HTML Page.

Thanks.
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 1,402
Reputation: ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light ShawnCplus is a glorious beacon of light 
Solved Threads: 225
Sponsor
ShawnCplus's Avatar
ShawnCplus ShawnCplus is offline Offline
Code Monkey

Re: Formated Source Code

 
0
  #2
Oct 2nd, 2009
Use <pre></pre> or <code></code> tags around it like:
  1. <pre>
  2. #include &lt;iostream&gt;
  3. int main(int argc, char** argv)
  4. {
  5. std::cout &lt;&lt; "Hello World!\n";
  6. return 0;
  7. }
  8. </pre>

Note the &lt; . Make sure you encode any HTML entities (<, >, &, etc.) so they don't get mixed in with the markup
Last edited by ShawnCplus; Oct 2nd, 2009 at 3:48 pm.
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 178
Reputation: codejoust is an unknown quantity at this point 
Solved Threads: 18
codejoust's Avatar
codejoust codejoust is offline Offline
Junior Poster

Re: Formated Source Code

 
0
  #3
Oct 2nd, 2009
Reply With Quote Quick reply to this message  
Reply

Tags
code, format, html, source

Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC