How to use gotoxy(x,y) function using codeblocks . My program works properly in turbo C but in other compilers it's not wrking. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to use gotoxy(x,y) function using codeblocks . My program works properly in turbo C but in other compilers it's not wrking.

I used # include< iostream> and using namespace std; though

6th Dec 2016, 7:04 PM
surabhi sethi
surabhi sethi - avatar
2 Answers
+ 2
I would suggest don't use goto statement.Because its make your Program Confusing. Yeah for small Program you can use it.
7th Dec 2016, 1:45 AM
Rahul Vashisth
Rahul Vashisth - avatar
+ 2
In windows, you have a small alternative... In codeblocks write the following function...: #include<windows.h> void gotoxy(int x=0,int y=0) { HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE); COORD new={x,y}; SetConsoleCursorPosition(out,new); } int main() { gotoxy(2,2); cout<<"Hello"; }
14th Jun 2017, 2:03 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar