I Have this code which should print the output in color but thats not happening.
please help
[code]
code.......
int myarray[] = { 100, 200, 300, 400, 500 };
for(i=0; ch!=27 ; )
{
ch=getch();
if(ch==80)
{
i++;
clrscr();
for (int j = 0; j < 5; ++j)
{
if (j == i)
{
textcolor(15);
cprintf("\n", myarray[j] );
// it should print the elements of myarray in color but it is not. :(
}
else
{
textcolor(7);
cprintf("\n", myarray[j]);
}
}
@Ericool
That doesn't do what you think it does, and it doesn't answer the OP's problem. Sorry.
@prankster
You are using Turbo C++, right? What version? (4.0 or better?)
What OS are using?
What is the value of the directvideo variable?
If playing with the directvideo variable doesn't help, you might have to run you program with DosBox -- which emulates the old 16-bit console environment. http://www.dosbox.com/