cpp to html

This is a discussion on cpp to html within the A Brief History of Cprogramming.com forums, part of the Community Boards category; I want to convert my source c++ code into html , and make keyword to highlight. I have find some ...

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    98

    cpp to html

    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.

    Code:
    #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;
    }
    Last edited by toysoldier; 08-16-2004 at 01:26 AM.

  2. #2
    Registered User axon's Avatar
    Join Date
    Feb 2003
    Posts
    2,572
    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.

    some entropy with that sink? entropysink.com

    there are two cardinal sins from which all others spring: Impatience and Laziness. - franz kafka

  3. #3
    Registered User axon's Avatar
    Join Date
    Feb 2003
    Posts
    2,572
    and one more thing....i think this is the widest post I have ever seen.

    some entropy with that sink? entropysink.com

    there are two cardinal sins from which all others spring: Impatience and Laziness. - franz kafka

  4. #4
    Registered User
    Join Date
    Jul 2004
    Posts
    98
    test again:
    Code:
    #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 ; 
    
    }
    Last edited by toysoldier; 08-16-2004 at 01:53 AM.

  5. #5
    Registered User
    Join Date
    Jul 2004
    Posts
    98
    HAHA.....succeed!

  6. #6
    ---
    Join Date
    May 2004
    Posts
    1,379
    dev c++ has an export to html feature

    #include <stdio.h>

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

  7. #7
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    You could also use the php tag instead of code. It has coloring, though it's different from the normal C++ editor.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  8. #8
    ---
    Join Date
    May 2004
    Posts
    1,379
    i like the [source] [/source] tags over at www.gamedev.net
    they have msvc++ style colouring

  9. #9
    Registered User
    Join Date
    Jul 2004
    Posts
    98
    I have fond this great software, please read this article:

    Coloring Your Code in vBulletin Posts

    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.

  10. #10
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,810
    Thats nice toysoldier good link
    Woop?

  11. #11
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    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.

  12. #12
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Ober I think the OP wanted some way to take his code and convert it to a syntax highlighed HTML

  13. #13
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    oops. Misread the situation.

  14. #14
    They Call me Mister Sako
    Join Date
    Jul 2004
    Posts
    169
    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?
    AIM: MisterSako | MSN: sakotheinsane@hotmail.com | E-mail: klinerr1@nc.rr.com
    The goal of computer science is to be lazy

  15. #15
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    No, HTML is more "marking up". Hence the name.
    JavaScript is more "scripting". Hence the name.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Please Help - C code creates dynamic HTML
    By Christie2008 in forum C Programming
    Replies: 19
    Last Post: 04-02-2008, 08:36 PM
  2. Replies: 2
    Last Post: 04-09-2006, 08:20 PM
  3. Multiple Cpp Files
    By w4ck0z in forum C++ Programming
    Replies: 5
    Last Post: 11-14-2005, 02:41 PM
  4. Design + HTML
    By orbitz in forum C Programming
    Replies: 8
    Last Post: 11-21-2002, 06:32 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21