+ 1

How to put the cursor to the previous line after using puts() in C++

14th Sep 2017, 3:31 PM
Z....R
Z....R - avatar
2 Answers
+ 3
Is puts() C++? No. Why do you use it? I assume you use Turbo C++... In Turbo C++ (Though you shouldn't use it as it is deprecated), we have a gotoxy() function under <graphics.h>. You use it in the following way : gotoxy(2,2); cout<<"Hello"; To set the Cursor Position in Code::Blocks, you may use SetConsoleCursorPosition in the following way , and include <windows.h> in your program... void GOTO(int x, int y) { HANDLE out = GetStdHandle (STD_OUTPUT_HANDLE); COORD pos = {x,y}; SetConsoleCursorPosition(out,pos); } Then use it in the following way : GOTO(2,2); cout<<"Hello";
15th Sep 2017, 2:51 PM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 2
Maybe you can find some answers here http://www.cplusplus.com/forum/general/41709/
15th Sep 2017, 7:16 AM
Daniel
Daniel - avatar