#include <graphics.h>
void int_to_char(int i,char *p)
{
if (i >= 0 && i < 10)
{
*p = 48;
*(p + 1) =i+ 48;
}
else
{
*p = i / 10+48;
*(p + 1 )= i % 10+48;
}}
void main()
{ initgraph(640, 480);
RECT r = { 20,20,100,100 };
char a[2];
setlinecolor(WHITE);
setfillcolor(RED);
BeginBatchDraw();
for (int i = 1; i<101; i++)
{int_to_char(i,a);
drawtext(a, &r, DT_RIGHT);
FlushBatchDraw();
Sleep(1000);
cleardevice(); }
EndBatchDraw();
closegraph();}
void int_to_char(int i,char *p)
{
if (i >= 0 && i < 10)
{
*p = 48;
*(p + 1) =i+ 48;
}
else
{
*p = i / 10+48;
*(p + 1 )= i % 10+48;
}}
void main()
{ initgraph(640, 480);
RECT r = { 20,20,100,100 };
char a[2];
setlinecolor(WHITE);
setfillcolor(RED);
BeginBatchDraw();
for (int i = 1; i<101; i++)
{int_to_char(i,a);
drawtext(a, &r, DT_RIGHT);
FlushBatchDraw();
Sleep(1000);
cleardevice(); }
EndBatchDraw();
closegraph();}