Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. How to check less then / greater then

How to check less then / greater then

Scheduled Pinned Locked Moved The Weird and The Wonderful
csscomgame-devtoolstutorial
11 Posts 10 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P ParagPatel

    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!");
    		}
    	}
    

    Reference[^]

    Parag Patel Sr. Software Eng, Varaha Systems

    S Offline
    S Offline
    StM0n
    wrote on last edited by
    #2

    if(guess < random && guess != random)
    {
    printf("\nToo low, try again!");
    }

    if(guess > random && guess != random)
    {
    printf("\nToo high, try again!");
    }

    nice... my guess would be: never trust a computer...

    (yes|no|maybe)*

    1 Reply Last reply
    0
    • P ParagPatel

      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!");
      		}
      	}
      

      Reference[^]

      Parag Patel Sr. Software Eng, Varaha Systems

      J Offline
      J Offline
      Jeroen De Dauw
      wrote on last edited by
      #3

      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!

      1 Reply Last reply
      0
      • P ParagPatel

        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!");
        		}
        	}
        

        Reference[^]

        Parag Patel Sr. Software Eng, Varaha Systems

        M Offline
        M Offline
        Michael Bookatz
        wrote on last edited by
        #4

        was he irish by any chance... you got to be sure after all?

        1 Reply Last reply
        0
        • P ParagPatel

          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!");
          		}
          	}
          

          Reference[^]

          Parag Patel Sr. Software Eng, Varaha Systems

          N Offline
          N Offline
          Nagy Vilmos
          wrote on last edited by
          #5

          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.

          1 Reply Last reply
          0
          • P ParagPatel

            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!");
            		}
            	}
            

            Reference[^]

            Parag Patel Sr. Software Eng, Varaha Systems

            N Offline
            N Offline
            Nemanja Trifunovic
            wrote on last edited by
            #6

            That's called Defense in Depth[^]

            Programming Blog utf8-cpp

            D 1 Reply Last reply
            0
            • N Nemanja Trifunovic

              That's called Defense in Depth[^]

              Programming Blog utf8-cpp

              D Offline
              D Offline
              Dan Neely
              wrote on last edited by
              #7

              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

              1 Reply Last reply
              0
              • P ParagPatel

                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!");
                		}
                	}
                

                Reference[^]

                Parag Patel Sr. Software Eng, Varaha Systems

                S Offline
                S Offline
                SalarSoft
                wrote on last edited by
                #8

                This one is better to be sure:~

                if(guess == random && !(guess != random))

                :laugh:

                www.softprojects.org

                S P 2 Replies Last reply
                0
                • P ParagPatel

                  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!");
                  		}
                  	}
                  

                  Reference[^]

                  Parag Patel Sr. Software Eng, Varaha Systems

                  S Offline
                  S Offline
                  Simone Serponi
                  wrote on last edited by
                  #9

                  well... maybe the coder wished to cover ALL cases... :laugh: :laugh: :laugh:

                  Bye By(t)e ;-)

                  1 Reply Last reply
                  0
                  • S SalarSoft

                    This one is better to be sure:~

                    if(guess == random && !(guess != random))

                    :laugh:

                    www.softprojects.org

                    S Offline
                    S Offline
                    Simone Serponi
                    wrote on last edited by
                    #10

                    if(guess == random && !(guess != random)) Can we call it an example of "psychotic" programming? :laugh: :laugh: :laugh:

                    Bye By(t)e ;-)

                    1 Reply Last reply
                    0
                    • S SalarSoft

                      This one is better to be sure:~

                      if(guess == random && !(guess != random))

                      :laugh:

                      www.softprojects.org

                      P Offline
                      P Offline
                      perels
                      wrote on last edited by
                      #11

                      This is my five cents ;-)

                      if(guess == random || guess != random)

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups