With SetConsoleCursorPosition (assuming you're on Windows)
The link again (for documentation so you can see how the function works. This is not a download link):
http://msdn.microsoft.com/en-us/library/windows/desktop/ms686025(v=vs.85).aspx
giblit provided an example for you earlier in the thread of how to move the cursor to a specific X,Y coordinate.
I am not talking about other third party, but using only a very basic c++ coding |
C++ is a language. The language itself allows you to create variables and move information around. It does not have any facilities for any kind of input/output to the user. For that... you need libraries.
Libraries extend the language by giving you functions/objects which can be used to input/output.
C++ comes bundled with a
standard library. This library includes things like cout, cin, string, vector, fstream, etc, etc. Any time you #include some kind of header, you are probably adding some part of the standard library to your program.
The standard library has
no way to move the console cursor. It is not available anywhere in it. If you are using the standard library alone... moving the cursor is
impossible.
Apart from the standard library... other libraries come bundled with the compiler when you installed it. If you are on Windows, your compiler almost certainly came bundled with WinAPI (ie: the <Windows.h> header). So this library is likely available to you without you having to do any extra work.
Windows.h
does have a way to move the cursor (with SetConsoleCursorPosition). So if you are on Windows, you can use that function.
Other libraries (like SFML, Ncurses, SDL, Allegro, wxWidgets, Qt, boost, etc) can be downloaded from the internet and installed. Unlike the standard library and WinAPI, these other libraries are not available to you immediately after you installed your compiler. You will need to install them separately if you want to use them.
If you do not want to use a downloaded lib... and if you are on Windows... you can use WinAPI.
If you do not want to use a downloaded lib and you do not want to use WinAPI, then it is impossible to do what you want to do with C++.