A simple question: in the FAQ is a gotoxy function;
how do I use it?
This doesnt work:
Code:gotoxy(100,20);
cout<<"Being on loacation 100,20";
Printable View
A simple question: in the FAQ is a gotoxy function;
how do I use it?
This doesnt work:
Code:gotoxy(100,20);
cout<<"Being on loacation 100,20";
The screen is usually only 80x25 characters in size. When you call it with 100 as x parameter it will ignore the call as this is bigger than 80. Try using values that fall within the screen sizeCode:gotoxy(10,15);
cout << "row 15, column 10";
And how do I go back to de default?
does not work because the program wil output 'hi' and 'how are you'Code:gotoxy(20,10); //only 8ox25
cout<<"hi";
gotoxy(0,0);
cout<<" how are you?";
all in the first line:(
Are you using gotoxy() from cronio.h? Or are you using a different one?
>>Are you using gotoxy() from cronio.h? Or are you using a different one?
Might be this one
I know, thats why I asked. But he could have copied it wrong.
The one from the faq, it does work but not if I want to use it a second time beacause then he will use only the second and skips the first
Try flushing the buffer before you call the second gotoxy().
Use this maybe:
cout <<"hi " <<endl;
Hey you're right
This doe work, only one thing; the bufferflush part waits for an enter so the output is now:Code:gotoxy(20,20);
cout<<"Hi"<<endl;
int ch;
while ((ch = cin.get()) != '\n' && ch != EOF);
gotoxy(10,11);
cout<<"Hi"<<endl;
: 'hi' (on coordinate 20,20)
: press enter
:'hi (on coordinate 10,11)
the enter part annoys me a bit, any suggestions?
>>the enter part annoys me a bit, any suggestions?
Yes, the code you've added flushed the input buffer, I meant for you to flush the output buffer :D Just using <<endl should have fixed your problem.
oh..:) well, thank you anyway