Total members 11890 |It is currently Thu Apr 25, 2024 9:21 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





In the following example we use CSS properties with samp tag to display C++ computer code.

Code:



<html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
title>Display computer code</title>
<
style type="text/css">
samp.code{
  
background#EEE;
  
border2px groove red;
  
color#111;
  
padding6px;
  
width300px;
  
displayblock;
}

</
style>
</
head>

<
body>
<
p><samp class="code">
      
std::vector<std::vector<double> > rawdata(3);<br/>
    
int datapts readdata_NxM(argv[4], rawdata);<br/>
    if (
datapts <= 0) {<br/>
        
std::cerr << "Error reading data from file \n" << argv[4] << std::endl;<br/>
        
usage(argv[0]);<br/>
    }<
br/>
<
br/>
    
// convert from Nx3 matrix to individual vectors. Not very elegant...<br/>
    
doublexpos = &rawdata[0][0];<br/>
    
doubleypos = &rawdata[1][0];<br/>
    
doubleclst = &rawdata[2][0];<br/>
    
doubleweights = &weightdata[0][0];<br/>

<
br/>
</
samp></p>

</
body>
</
html>

 




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : display code block using html
 read php file in asp and display it as html     -  
 I need help with a html code     -  
 How to link a c++ program with HTML code     -  
 threads block on I/O     -  
 braces block inside your class     -  
 .aspx render block results (response.write, <%=     -  
 Here is how to display any 2d array     -  
 display list     -  
 SEVEN SEGMENT DISPLAY     -  
 Display a different image for each day of the week     -  



Topic Tags

HTML SAMP
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com