for(i=1;i<10;i++)
{
cout<<"i= "<<i;
}

I want to print The label i as well as its value by using Outtextxy. Is it possible.
I knew that Outtextxy is used to display strings.
but i dont want to use cout.

Recommended Answers

same answer as your other thread.

Jump to Post

There is a better way to do it:

char buffer[30];

sprintf( buffer, "i = %d", num );
outtextxy( x, y, buffer );

This is a more general solution.

Jump to Post

All 6 Replies

same answer as your other thread.

Sorry i am not able to solve yet.

that compiler are you using? That is borland specific and will not work with non-borland compilers.

What are you trying to accomplish? There are probably other ways to do what you want to do. You can use these win32 api console functions to move the cursor to specific location. Just include windows.h in your program.

Use
char num[2];
outtextxy(x,y, itoa(integer, num, 10));

It works

Use
char num[2];
outtextxy(x,y, itoa(integer, num, 10));

It works

Thanks i got cleared now

There is a better way to do it:

char buffer[30];

sprintf( buffer, "i = %d", num );
outtextxy( x, y, buffer );

This is a more general solution.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.