PDA

View Full Version : cpp to html



toysoldier
08-15-2004, 11:55 PM
I want to convert my source c++ code into html ,
and make keyword to highlight.
I have find some covertion software ,
but it's not support html code in this site.
I have to convert html tags into vb code tags,
it wasted another editing time, no good idea,
So, someone know maybe there are some software
can directly convert cpp to sth with vb code tags ?
Thanks.



#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef struct
{
char morse[6];
char letter;
}morsecode;

int main(){

morsecode trans[36]={
{".-", 65}, {"-...", 66}, {"-.-.", 67}, {"-..", 68}, {".", 69}, {"..-.", 70},
{"--.", 71}, {"....", 72}, {"..", 73}, {".---", 74}, {"-.-", 75}, {".-..", 76},
{"--", 77}, {"-.", 78}, {"---", 79}, {".--.", 80}, {"--.-", 81}, {".-.", 82},
{"...", 83}, {"-", 84}, {"..-", 85}, {"...-", 86}, {".--", 87}, {"-..-", 88},
{"-.--", 89}, {"--..", 90}, {"-----", 48}, {".----", 49}, {"..---", 50},
{"...--", 51}, {"....-", 52}, {".....", 53}, {"-....", 54}, {"--...", 55},
{"---..", 56}, {"----.", 57}
};
char phrase[34] = {"DUDE WHERES THE 1978 GOGGO MOBILE"};
int search, index;
for(index = 0; index <= 33; index++){
for(search = 0; search <= 35; search++){
if(trans[search].letter == phrase[index]){
printf("%s ", trans[search].morse); }else if(phrase[index] == ' '){
printf(" ");
}else{
printf("\nError Char not found!!!\n");
}
}
}

return 0;
}

axon
08-16-2004, 12:00 AM
What the hell is this supposed to be? do you have a question?

I mean wtf?!

where is cheez when you need him?!? CHHHHHEEEEEEEEZZZZZ! let go of that damn bottle!



um, yeah.

axon
08-16-2004, 12:00 AM
and one more thing....i think this is the widest post I have ever seen.

toysoldier
08-16-2004, 12:50 AM
test again:


#include <iostream>
#include <conio.h>
#include <cstdlib>

using namespace std;

int main()
{
char m&#091;4&#093;="toy"; //4th character is '\0' (null).
char n&#091;4&#093;="000"; //same as above.
//char m&#091;3&#093;={'t','o','y'}; //to save original password.
//char n&#091;3&#093;={'0','0','0'}; //initialize your entering password.
cout<<"Please enter 3 bit password: "<<flush;
n&#091;0&#093;=getch(); //enter word ,but no display it
cout<<"*"<<flush; //when enter word, display “*”
n&#091;1&#093;=getch();
cout<<"*"<<flush;
n&#091;2&#093;=getch();
cout<<"*"<<endl;
if(strcmp(m, n) == 0) //compare the strings m and n
//if(m&#091;0&#093;==n&#091;0&#093;&&m&#091;1&#093;==n&#091;1&#093;&&m&#091;2&#093;==n&#091;2&#093;) //stupid code!
{
cout<<"password correct,welcome!"<<endl;

}
else
{
cout<<"error."<<endl;
}

system("pause"); //pause running window.
return 0 ;

}

toysoldier
08-16-2004, 12:56 AM
HAHA.....succeed!

sand_man
08-16-2004, 01:25 AM
dev c++ has an export to html feature

#include <stdio.h>

int main(void)
{
printf("Hello world");
return 0;
}

nvoigt
08-16-2004, 02:34 AM
You could also use the php tag instead of code. It has coloring, though it's different from the normal C++ editor.

sand_man
08-16-2004, 03:16 AM
i like the tags over at www.gamedev.net
they have msvc++ style colouring

toysoldier
08-16-2004, 04:31 AM
I have fond this great software, please read this article:

Coloring Your Code in vBulletin Posts (http://www.codeguru.com/Cpp/misc/samples/codehighlighting/article.php/c4693/)

author : Yves Maurer

Environment: Visual Basic and Visual C++ forums on CodeGuru

Introduction
I wrote a small utility that allows you to do some basic syntax highlighting when pasting C++ or Visual Basic code into vBulletin groups, instead of using the ugly PHP codes.

prog-bman
08-16-2004, 04:46 AM
Thats nice toysoldier good link :)

ober
08-16-2004, 06:18 AM
So you want to convert a something written in a dynamic programming language into a static markup page? WTF? Try a scripting language like PHP.

Thantos
08-16-2004, 08:48 AM
Ober I think the OP wanted some way to take his code and convert it to a syntax highlighed HTML

ober
08-16-2004, 08:59 AM
oops. Misread the situation.

MisterSako
08-16-2004, 03:08 PM
well C++ is more programming, HTML is more "scripting" theyre not really related. C++ is used for software while HTML is for websites.

edit: nevermind i think what your trying to do is post c++ source onto a html website... right?

sean
08-16-2004, 03:14 PM
No, HTML is more "marking up". Hence the name.
JavaScript is more "scripting". Hence the name.

JaWiB
08-16-2004, 10:11 PM
Is this a new trend? But haven't these things been around for a long time?

I'm trying to decide if I should bother (probably not) :rolleyes:

Waldo2k2
08-16-2004, 10:42 PM
Just so you guys know, there's a great syntax highlighter at andre-simon.de . I used it for my project website for a class, that way I could post the code that I was using in the page for explanation.

kermit
08-17-2004, 04:32 AM
Just so you guys know, there's a great syntax highlighter at andre-simon.de . I used it for my project website for a class, that way I could post the code that I was using in the page for explanation.

Hey thanks for the info - I have been looking for a syntax highlighter that supports CSS - the one at the site you gave does that - if also has a huge list of different output options - thanks a lot! :)

Waldo2k2
08-17-2004, 09:21 AM
no problem