#include <windows.h>
void gotoxy(int x,int y);
int main()
{
int i;
int y=6;
int x=9;
for(i=1;i!=0;i++)
{
system("color 1");
sleep(500);
gotoxy(x,y);
printf("%d",i);
}
getch();
}
void gotoxy(int x,int y)
{
COORD coord = {x,y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
}
How to change the color when the number changes ? And the color must be according to the
color attribute of console output.