How to check less then / greater then
-
if(guess == random)
{
printf("\nExcellent! You guessed the number!\nWould you like to play again?(y/n)");
scanf("%c",&play);
if(play == 'n')
{
game = 0;
}
}else { if(guess < random && guess != random) { printf("\\nToo low, try again!"); } if(guess > random && guess != random) { printf("\\nToo high, try again!"); } }
Parag Patel Sr. Software Eng, Varaha Systems
-
if(guess == random)
{
printf("\nExcellent! You guessed the number!\nWould you like to play again?(y/n)");
scanf("%c",&play);
if(play == 'n')
{
game = 0;
}
}else { if(guess < random && guess != random) { printf("\\nToo low, try again!"); } if(guess > random && guess != random) { printf("\\nToo high, try again!"); } }
Parag Patel Sr. Software Eng, Varaha Systems
-
if(guess == random)
{
printf("\nExcellent! You guessed the number!\nWould you like to play again?(y/n)");
scanf("%c",&play);
if(play == 'n')
{
game = 0;
}
}else { if(guess < random && guess != random) { printf("\\nToo low, try again!"); } if(guess > random && guess != random) { printf("\\nToo high, try again!"); } }
Parag Patel Sr. Software Eng, Varaha Systems
It's just to easy to imagine this person is now bragging about his program and trying to impress others with his coding skills - lol.
My little forums: http://code.bn2vs.com 70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!
-
if(guess == random)
{
printf("\nExcellent! You guessed the number!\nWould you like to play again?(y/n)");
scanf("%c",&play);
if(play == 'n')
{
game = 0;
}
}else { if(guess < random && guess != random) { printf("\\nToo low, try again!"); } if(guess > random && guess != random) { printf("\\nToo high, try again!"); } }
Parag Patel Sr. Software Eng, Varaha Systems
was he irish by any chance... you got to be sure after all?
-
if(guess == random)
{
printf("\nExcellent! You guessed the number!\nWould you like to play again?(y/n)");
scanf("%c",&play);
if(play == 'n')
{
game = 0;
}
}else { if(guess < random && guess != random) { printf("\\nToo low, try again!"); } if(guess > random && guess != random) { printf("\\nToo high, try again!"); } }
Parag Patel Sr. Software Eng, Varaha Systems
if(guess == random)
{
[...]
}
else
{
if(guess < random &&
guess != random)
{
[...]
}
else
{
if(guess > random &&
guess != random &&
!(guess < random &&
guess != random))
{
[...]
}
}
}Fixed it!!
Panic, Chaos, Destruction. My work here is done.
-
if(guess == random)
{
printf("\nExcellent! You guessed the number!\nWould you like to play again?(y/n)");
scanf("%c",&play);
if(play == 'n')
{
game = 0;
}
}else { if(guess < random && guess != random) { printf("\\nToo low, try again!"); } if(guess > random && guess != random) { printf("\\nToo high, try again!"); } }
Parag Patel Sr. Software Eng, Varaha Systems
That's called Defense in Depth[^]
-
That's called Defense in Depth[^]
Interesting article, but it only has backward links. Is there a list that links to all 11 parts available somewhere?
It is a truth universally acknowledged that a zombie in possession of brains must be in want of more brains. -- Pride and Prejudice and Zombies
-
if(guess == random)
{
printf("\nExcellent! You guessed the number!\nWould you like to play again?(y/n)");
scanf("%c",&play);
if(play == 'n')
{
game = 0;
}
}else { if(guess < random && guess != random) { printf("\\nToo low, try again!"); } if(guess > random && guess != random) { printf("\\nToo high, try again!"); } }
Parag Patel Sr. Software Eng, Varaha Systems
This one is better to be sure:~
if(guess == random && !(guess != random))
:laugh:
-
if(guess == random)
{
printf("\nExcellent! You guessed the number!\nWould you like to play again?(y/n)");
scanf("%c",&play);
if(play == 'n')
{
game = 0;
}
}else { if(guess < random && guess != random) { printf("\\nToo low, try again!"); } if(guess > random && guess != random) { printf("\\nToo high, try again!"); } }
Parag Patel Sr. Software Eng, Varaha Systems
well... maybe the coder wished to cover ALL cases... :laugh: :laugh: :laugh:
Bye By(t)e ;-)
-
This one is better to be sure:~
if(guess == random && !(guess != random))
:laugh:
if(guess == random && !(guess != random)) Can we call it an example of "psychotic" programming? :laugh: :laugh: :laugh:
Bye By(t)e ;-)
-
This one is better to be sure:~
if(guess == random && !(guess != random))
:laugh: