Friday, February 19, 2010

print text in color

Q. Why don't printf() and puts() print text in color?

A. Use the console I/O functions cprintf() and cputs() for color output.

#include

int main(void)

{

textcolor(BLUE);

cprintf("I'm blue.");

}

Q. How do I print a long integer?

A. Use the "%ld" format:

long int l = 70000L;

printf("%ld", l);

Q. How do I print a long double?

A. Use the "%Lf" format.

long double ldbl = 1E500;

printf("%Lf", ldbl);

E x a m p l e P r o g r a m s

----------------------------------------------------------------------

Q. How do I compile the BGIDEMO program?

A. 1. Make sure that the following Turbo C++ files are in your

current directory:

BGIDEMO.C

*.BGI

*.CHR

No comments:

Post a Comment