How to move characters on screen in C++ (plain) ?

Hi all,

Can anyone of you tell me how to move a character (an arrow or any other character) on screen using keyboard? I'm actually a beginner and have only wrote simple (starter's) programs in C++. It would be great if you tell me without using any external library which is not included in C++ by default (in other words, using plain C++).

Any help would be appreciated.
Thanks.
Last edited on
Anyone?
"Plain" C++: not possible.

What you see on screen is drawn by someone. Someone that can collaborate with the OS, drivers, and hardware. One can, in principle, reimplement most of it but in practice you really want to use existing libraries.
@keskiverto
it is definitely possible.

@HamzaUmar
use for loop :

1
2
3
4
5
for(int i=0;i<100;i++)
{
         cout<<setw(i)<<"->";

}


this will create an arrow (->) moving towards right.
@HamzaUmar

look here, where I show how to use the keyboard to move a letter around. It should help you with your program.


http://v2.cplusplus.com/forum/general/95312/
Last edited on
@HamzaUmar

look here, where I show how to use the keyboard to move a letter around. It should help you with your program.


http://v2.cplusplus.com/forum/general/95312/


@whitenite1
he is asking for plain c++ :)
@aalok

OP also said
without using any external library which is not included in C++ by default

which to me, means... No Ncurses, SFML, Allegro, etc..

All of the libraries used are included with standard C++. True, I also used graphic characters to create the frames, but those are also standard. The main part of the program the OP needed, is the way to move the character on screen. The rest is just, well, 'window dressing' so to speak.

Well, these were my reasoning's. If the OP can use it, great, if not, so be it. :)
All of the libraries used are included with standard C++.

conio.h and Windows.h are hardly "standard C++". They are very OS-specific.

@aalok: "Plain" C++ as in "no rewriting of OS from scratch".
Topic archived. No new replies allowed.