home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 8
/
amigaformatcd08.iso
/
in_the_mag
/
html_tutorial
/
pr.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1996-09-03
|
1KB
|
57 lines
#include <iostream.h>
inline void html( char str[] ) { cout << str << "\n"; }
inline void html_( char str[] ) { cout << str; }
inline void html_( char c ) { cout << c; }
void write_number( const int number )
{
int number_to_print = number;
if ( number < 0 ) // Make +ve
{
number_to_print= -number; cout << "-";
}
int first_digit = number_to_print%10; // Split
int other_digits = number_to_print/10; //
if ( number_to_print >= 10 ) // More than 1 digit
{
write_number( other_digits ); // Other digits
}
cout << (char) (first_digit + (int) '0'); // First digit
}
inline void html_( int n )
{
write_number( n );
}
void main()
{
html("<TABLE BORDER CELLPADDING=2>");
html("<TH ALIGN=LEFT> Character</TH>");
html("<TH ALIGN=LEFT> Represent by sequence </TH>");
html("<TH ALIGN=LEFT> Character</TH>");
html("<TH ALIGN=LEFT> Represent by sequence </TH>");
html("<TH ALIGN=LEFT> Character</TH>");
html("<TH ALIGN=LEFT> Represent by sequence </TH>");
const int start=33;
for( int i=start; i<=255; i++ )
{
if ( (i-start)%3==0 )
{
html("");
html("<TR>");
}
html_("<TD ALIGN=LEFT> "); html_(i); html(";</TD>");
html_("<TD ALIGN=LEFT>");
html_( "<TT>&#"); html_(i); html(";</TT>");
html_( "<BR></TD>");
}
html("</TABLE>");
}