Thread: C++ Code Formatter

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    14

    C++ Code Formatter

    Hi,

    I just created my own syntax highlighter, which formats C++ code with the color tags for this forum. So it's easier to post my code.

    If anybody would like to see it, i'll post it up on the forum for download.

    Testing:

    Code:
    #include <iostream>
    #include <string>
    
    int AddNumbers(int Number1, int Number2);
    
    int main(void)
    {
    	//display hello world message
    	cout << "Hello World" << endl;
    
    	//show a sum and its result
    	cout << "The sum of 2 + 2 = " << AddNumbers(2, 2) << endl;
    	return 0;
    };
    
    int AddNumbers(int Number1, int Number2)
    {
    	//declare variable for storing result
    	int SumResult;
    
    	//get the answer to the sum
    	SumResult = Number1 + Number2;
    	
    	//return the total result
    	return SumResult;
    };
    Yippee!
    VD
    Last edited by Visual Develope; 05-27-2002 at 06:47 PM.
    Set VBDeveloper = New VisualCDeveloper

  2. #2
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    If it's coded without any windows specific libraries, I could make sure it works under Linux as well, if you want me to.
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

  3. #3
    Registered User
    Join Date
    Feb 2002
    Posts
    14
    Opps, forgot to tell you all. I coded it in VB6.
    Set VBDeveloper = New VisualCDeveloper

  4. #4
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802
    I did the same thing in MFC, I almost had it finished but I lost it along with all my other programs when my HD crashed. Oh well I had plans for number and string highlighting too... it woulda been great.

    Well done btw Although I see some keywords in there that aren't highlighted... or was this on purpose?

  5. #5
    Registered User
    Join Date
    Feb 2002
    Posts
    14
    Erm..could be a bug. I'll check that out. It seems it's not adding tags for any keywords within a function body...

    By the way, I'm still learning C++, so how did you go about creating the similar application using C++ and the MFC?

    Thanks anyway.

    VD

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Explain this C code in english
    By soadlink in forum C Programming
    Replies: 16
    Last Post: 08-31-2006, 12:48 AM
  2. Linux C source code formatter utility
    By BobS0327 in forum Tech Board
    Replies: 2
    Last Post: 04-08-2006, 06:53 PM
  3. Updated sound engine code
    By VirtualAce in forum Game Programming
    Replies: 8
    Last Post: 11-18-2004, 12:38 PM
  4. Replies: 0
    Last Post: 02-21-2002, 06:05 PM