Advertisement Jump to content


This topic is now archived and is closed to further replies.


Basic C++ 'cout' question

This topic is 6185 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How do you move the virtual cursor? For instance, say I had this line: cout<<"__________"; And then... cin>>x; But I want to have the cin OVERWRITE the cout... as in backing up the virtual cursor ten spaces so that whatever is typed will replace the characters below it...

Share this post

Link to post
Share on other sites
try this:


#include <windows.h>
#include <iostream>
usuing namespace std;

int main()

COORD cursor = {0,0};

cout << "________";
SetConsoleCursorPosition(H_OUTPUT, cursor);
cin >> x;

return 0;


Try that I didn't test it but I think it will work.

COORD cursor is the place where you want it to go. Play around with the values and see what happens.

Jeff D

Suffered seven plagues, but refused to let the slaves go free. ~ Ross Atherton

Edited by - Jeff D on February 17, 2002 2:36:56 AM

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!