Thursday, August 2, 2007

Interesting C Program -13

Hey!!! Now u can change the color of the output window (DOS window). How?

Just try the following program:


#include "stdio.h"
#include "string.h"
#include "stdlib.h"
main()
{
int i=0;
for(i = 0;i<3;i++)
{
char x[] = "color ";
(i==0)?strcat(x,"0F"):((i==1)?strcat(x,"1E"):((i==2)?strcat(x,"2D")\
:strcat(x,"3C")));
system(x);
system("pause");
}
}


Your output window looks colorful right?

No comments:

Search Google

Books that I refer to...

  • The Complete Reference C, Fourth Edition
  • The C Programming Language