hey all, i just have a question about this guessing game code on the site. What exactly is the point of using else to tell the person there wrong and have "you guess to low/high" on there?...There really both just telling you that your wrong
Code:
#include <stdlib.h>
#include <iostream.h>
int main()
{
int number=rand()%100;
int
guess=-1;
int trycount=0;
while(guess!=number && trycount<8)
{
cout<<"Please enter a guess: ";
cin>>guess;
if(guess<number)
cout<<"Too low"<<endl;
if(guess>number) cout<<"Too high"<<endl;
trycount++;
}
if(guess==number)
cout<<"You guessed the
number";
else
cout<<"Sorry, the number was:
"<<number;
return 0;
}