I have made improvements to my number game. I have made it so you have to enter a number that you will guess. Like this:
You enter 651. That would be the number you have to guess.
But, when you enter the 651, it stays viewable. I want it to make it so the number doesn't show up. Here's what happens:
Enter the number you will be trying to guess: 651
Is it possible to make the 651 appear as something else after you push enter? Here's the script for my program:
Code:
//Number game
#include <iostream.h>
#include <conio.h>
int main()
{
//game description
cout<< "I took this out because of a scroll bar. It was just rules for the game.";
//entering the correct number
int correct;
cout<<"Enter the number that you will be trying to guess:";
cin>>correct;
//entering loopcounts
int loopCount;
loopCount=15;
//entering a guess
int guess;
while(loopCount>0)
{
//enter the guess
loopCount=loopCount--;
cout<<"Enter a guess:\n";
cin>>guess;
if(guess==correct)
{
//correct
cout<<"That is correct! Press any key to exit.\n";
getch();
break;
}
else
if(guess>correct)
{
//lower message
cout<<"That is incorrect. The number is lower. Only "<<loopCount<<" guesses remaining.\n";
}
else
{
//higher message
cout<<"That is incorrect. The number is higher. Only "<<loopCount<<" guesses remaining.\n";
}
}
return 0;
}