Can i hide the input text?

Hi all,

I am coding a simple game for my c++ course; "Rock Paper Scissors"


I have it all done but it would be nice if it could actually be played. As it is, player 2 can see player 1's input on the screen. Kinda defeats the purpose. Any tips? I am using netbeans to compile...


If it makes a difference I used switches create the program. I'd like to do it without scratching the whole project. I read about using strings and getch but that would mean starting over.

Also the input is one character 'r' or 'p' or 's'

Thanks
Last edited on
If I may ask, why would two players play RPS on the computer? Why not have a CPU player instead...?
(If you want to specifically make it for two players, then I'll suggest what you need, but otherwise, RPS on a PC is usually played against the CPU)

What you want is available in the non-standard conio.h file, as the getch() function (You wouldn't need to start over). I've heard NCurses is a good library and may help you out, though I've not used it myself, just heard about it.
OR
You could clear the screen after player 1 inputs their choice.
OR
Maybe one of the more experienced users on this forum may be able to help you out better...
Thanks for replying.

The textbook problem specifically asks for two users.

I am interested in clearing the screen, is there a command for this. I kinda faked it by adding a lot of space between inputs, but I didn't like how it looked.
For a small program like this I would recommend just using system("cls") for Windows or system("clear") for Linux to clear the screen (and have everyone hate me for saying it, as system calls aren't too popular).

There are other methods to clear the console screen using windows functions but that is kind of going over the top here.
http://msdn.microsoft.com/en-us/library/ms682022%28VS.85%29.aspx

conio.h also has a function for it but that is outdated and again not recommended.
Topic archived. No new replies allowed.