Little problem in game

So, the following is a little game I am working on it, all the things are going good but I am facing a little problem as I am making a guessing game in which first player will write any number and second player has to guess that number to be winner but problem is when first player enters its number it is visible so how to hide it from second player?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <iostream>
using namespace std;
int main()
{
	int number, guess;
	char again;

	cout << "Lets Play a guessing game, in this game first player will write\n"
		<< "any number and second player has to guess it\n";
	cout << "And computer will also help the second player to make a correct guess\n";
	cout << "     \n";


	do
	{
		cout << "First player please enter your number\n";
		cin >> number;

		do
		{
			cout << "Second player enter your guessing number\n";
		    cin >> guess;

		    if (guess > number)
			{
				cout << "Too, high guess make some smaller guess\n";
				cout << "    \n";
				cout << "Lets try again\n";
			}
		    else if (guess < number)
			{
				cout << "Too, low guess make some big guess\n";
				cout << "   \n";
				cout << "Lets try again\n";
		    }
			else
				cout << "   \n";
		} while (guess != number);

		if (guess == number)
			cout << "You, are Winer\n";
		else
			cout << "   \n";

		cout << "   \n";

		cout << "Do you want to play again\n";
		cout << "Type Y for yes and N for No\n";
		cin >> again;
	} while ( again == 'y' || again == 'Y');

	cout << "Ok, thanks for playing\n";

	return 0;
}
Im guessing the second player would be sitting next to you looking at the same screen. You could clear the screen or just print out like 25 new lines so it scrolls down far enough. So that you can't see it.

Or check out this thread, might have something interesting - http://stackoverflow.com/questions/6899025/hide-user-input-on-password-prompt
Last edited on
How to clear input?
Read this thread for how to clear the console on Windows - http://stackoverflow.com/questions/6486289/how-can-i-clear-console
I found two things first is system("CLS"); and second is getch(). What is getch() and how to use it?
Last edited on
Im gonna ask the same question I saw someone else ask in a previous thread. Is google broken? Type getch on google, it's not that hard.
If I have to search my own everything on google and stackoverflow then what I am going on cplusplus. What the....
#TarikNeaj if you don't want to help then please leave.
Last edited on
No, you dont have to search everything on google. If you have a specific problem you should post it, because specific problem with your own code cant be googled. But if you heard about memory allocation for example and wanted to know what it is, instead of wasting your own time, as well as everyone elses time on answering something that has been answered since the the dinosaurs were walking on earth, you can type "Memory allocation" In google, get hundreds/thousands of links explaining what it is.

For small questions as "what is this getch" it literally takes 10 seconds to type it in google, and another 30 seconds to read what it does. No need to post it and wait for an answer which can take minutes if not much longer. It's 2016, use google, it has the answers you want for the most part, this will help you, using google is good for you.

When I tell people to google it, it's not because I hate them and want nothing to do with them. It's to help them. Learn how to use google, and you dont need to post as much anymore, it is very effective.

Edit: Actually yes, You should google everything, every little thing. When you cant find anything on google to really help you out, that's the best time to post on a forum. That's just my opinion though.

#TarikNeaj if you don't want to help then please leave.

As I stated earlier, telling you to use google is the best help I can give you.
Last edited on
So, that is why I am saying a specific point that how to hide input and you said go to stackoverflow.
So, that is why I am saying a specific point that how to hide input and you said go to stackoverflow.


Are you fucking joking? Why should Anyone reexplain something when they can just link you a thread where the question was asked and proparly answered? That makes no freaking sense.I didnt tell you to go to stackoverflow, I literally linked you a thread about your problem, don't come up with bullshit. Be fucking happy I'm helping you here, I do this on my free time, for nothing in return. Stop being such an ungrateful dick.

Think about it, there is a reason why no one else has answered your thread. Yes they see your thread, but chose to ignore it. Either because they saw that I already provided you reasonable help, or that they dont wanna bother answering this question.
Last edited on
Ok if other are not answering my question but it is good choice not to answer instead of using abuse language.
Topic archived. No new replies allowed.