SourceFormatX

Overview

Features

Why Use It

Formatting Show

Integration

Screenshots

Documentation

FAQs & Tips

Update History

Award Gallery

Testimonials

License Policy

CodeMorph

CodeToHtml

C++ Source Code Formatting Show


SourceFormatX code formatter bases on professional syntax parse engines so it can format C++ source code files with omnifarious styles, even these unorderly C++ source code examples below:

C/C++ Java C# Delphi (Pascal)
PHP JSP ASP JavaScript
Visual Basic VB.NET VBScript HTML Components
80x86 ASM 8051 ASM CORBA IDL


  C/C++ Source Code Formatting Examples:     Example 1   |   Example 2   |   Example 3   |   Example 4   |   Example 5

This C++ source code formatted by SourceFormatX C++ Formatter comes from IOCCC too, source code was arranged like the symbol of a communicator pin from the Star Trek: The Next Generation.

  /* Before C++ Code Formatting */

  #include<stdio.h>
  #include<string.h>
  #include<stdlib.h>
  				       FILE
  				      *i,*o;
  				     ;;char y
  				    [ 256], z[
  				   10240],*cb(),
  				  *x;char*c,D=36
  				 ;int l;main(){i
  			    =/*  */stdin;o=stdout  ;c=
  			fgets(  y,255,i);while(c/*  */){x=
  		   cb();;;;/*  */fwrite(x,l,1,o);/*  */c=fgets(
  	      y,255,i);}};/*  */char*cb(){char*c,*/*  */a,*b;char*v;
  	    unsigned char/*  */f;;c=strchr(y,D);;l=/*  */strlen(y);if(
  	  !c){return(y);/*  */}a=y;b=z;while(*a){if(/*  */*a!=D) *b++=*a
  	 ++;else{a++;c=/*  */strchr(a,D);if(c){*c=0;;/*  */if(strchr(a,32
  	)){*c=D;*b++=D/*  */;}else{;v=getenv(a);if(v){/*  */while(*v){if(*
  	v!=92)*b++=*v/*  */++;else{f=0/*  **  */;v++;if/*  */(*v<48||*v>57
  	)*b++=92;/*p%*  */else{f=(*v/*  */++/*  */)-48;;/*  */if(*v<48||*v
  	>57)*b++=f;/*  */else{f=(/*  */f<<3)+(/*  */*v++)/*  */-48;;*b++=(
  	 (*v<48||*/*  */v>57)?f/*  */:((f<<3)+(*/*  */v++)/*  */-48));}}}
  	  ;}a=c+1/*  */;}else/*  */{*c=D;*b++=D;;;;/*  */while (*a != D)
  	    *b++/*  */=*a++/*  */;a++;*b++=D;}}}else{/*  */*b/* */++=D;
  	      }/*  */}}l=/*  */b-z;return(z);}int*tng()/*  *//*  *)'
  		  */{if/*  */(x==c||c!=x){x=cb();l<<=l>>1/*  *(*
  		 */;/*     */;strcpy(&D,"(C)1995");l=l/*       */
  		*l;/*         */}/*G.Glendown%^x*//*            ;
  	       */
  	      }


  /* After C++ Code Formatting */

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

  FILE *i, *o;
  ;
  ;
  char y[256], z[10240], *cb(), *x;
  char *c, D = 36;
  int l;
  main()
  {
    i =  /*  */stdin;
    o = stdout;
    c = fgets(y, 255, i);
    while (c /*  */)
    {
      x = cb();
      ;
      ;
      ; /*  */
      fwrite(x, l, 1, o); /*  */
      c = fgets(y, 255, i);
    }
  }; /*  */

  char *cb()
  {
    char *c,  */*  */a,  *b;
    char *v;
    unsigned char /*  */f;
    ;
    c = strchr(y, D);
    ;
    l =  /*  */strlen(y);
    if (!c)
    {
      return (y); /*  */
    }
    a = y;
    b = z;
    while (*a)
    {
      if ( /*  */ *a != D)
        *b++ =  *a++;
      else
      {
        a++;
        c = /*  */strchr(a, D);
        if (c)
        {
          *c = 0;
          ; /*  */
          if (strchr(a, 32))
          {
            *c = D;
            *b++ = D /*  */;
          }
          else
          {
            ;
            v = getenv(a);
            if (v)
            {
              /*  */
              while (*v)
              {
                if (*v != 92)
                  *b++ =  *v/*  */++;
                else
                {
                  f = 0 /*  **  */;
                  v++;
                  if /*  */(*v < 48 ||  *v > 57)
                    *b++ = 92;
                    /*p%*  */
                  else
                  {
                    f = (*v /*  */++ /*  */) - 48;
                    ; /*  */
                    if (*v < 48 ||  *v > 57)
                      *b++ = f;
                      /*  */
                    else
                    {
                      f = (/*  */f << 3) + ( /*  */ *v++) /*  */ - 48;
                      ;
                      *b++ = ((*v < 48 ||  * /*  */v > 57) ? f /*  */: ((f << 3)
                         + (*/*  */v++) /*  */ - 48));
                    }
                  }
                }
                ;
              }
              a = c + 1 /*  */;
            }
            else
            /*  */
            {
              *c = D;
              *b++ = D;
              ;
              ;
              ; /*  */
              while (*a != D)
                *b++ /*  */ =  *a++ /*  */;
              a++;
              *b++ = D;
            }
          }
        }
        else
        {
          /*  */ *b/* */++ = D;
        } /*  */
      }
    }
    l = /*  */b - z;
    return (z);
  }

  int *tng() /*  */ /*  *)' */
  {
    if /*  */(x == c || c != x)
    {
      x = cb();
      l <<= l >> 1 /*  *(* */
      ; /*     */
      ;
      strcpy(&D, "(C)1995");
      l = l /*       */ * l; /*         */
    } /*G.Glendown%^x*/ /*            ;
     */
  }

Example 1   |   Example 2   |   Example 3   |   Example 4   |   Example 5

  Want to format C and C++ source code automatically?  Try SourceFormatX C++ Code Formatter Free Trial Now!