Files
harbour-core/harbour/examples/misc/guess.prg
Viktor Szakats 461ea1568f 2009-05-29 11:04 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
- contrib/examples
  + examples
  * doc/dirstruc.txt
  * doc/whatsnew.txt
  * examples/hbdoc/Makefile
  * examples/pp/Makefile
  * examples/hboleold/Makefile
  * examples/hbsqlit2/Makefile
  * examples/misc/Makefile
  * examples/hbapollo/Makefile
  * examples/rdddbt/Makefile
  * examples/guestbk/Makefile
  * examples/pe/Makefile
  * examples/hbgf/hbgfwin/Makefile
  * examples/hbgf/hbgfos2/Makefile
  * examples/hbgf/hbgfgtk/Makefile
  * examples/hbgf/Makefile
  * examples/uhttpd/readme.txt
  * examples/dbu/Makefile
  * examples/hscript/Makefile
  * examples/hbwhat/Makefile
  * examples/rl/Makefile
  * examples/Makefile
    * Moved to flatten our dir layout and sync the locations
      in unified distro and source tree.
    ; TODO: As a next step I'll replace Makefiles with .hbm 
            files. This will allow users to build these parts 
            outside the source distribution.
2009-05-29 09:05:10 +00:00

58 lines
1.1 KiB
Plaintext

/*
* $Id$
*/
/*
Guess a number
Date : 1999/04/22
My first application (big word) written in Harbour
Written by Eddie Runia <eddie@runia.com>
www - http://www.harbour-project.org
Placed in the public domain
*/
EXTERN OutStd
PROCEDURE Main()
local flGuessed
local CRLF := chr(13)+chr(10)
local nSeed := 241
local nPick
QQOut( "Welcome to guess a number....", CRLF )
QQOut( "You have to guess a number between ",0," and 255", CRLF )
do while Upper( Read( "Continue Y/N : " ) ) == "Y"
nSeed := (( nSeed * 11) + 5) % 256
flGuessed := 0
do while flGuessed == 0
nPick := Val( Read( "Value : " ) )
if nPick > 255
QQOut( "More than 255", CRLF )
elseif nPick < 0
QQOut( "Less than 0", CRLF )
elseif nPick > nSeed
QQOut( "Try lower", CRLF )
elseif nPick < nSeed
QQOut( "Try higher", CRLF )
else
QQOut( "Congratulations, you've guessed the number", CRLF, CRLF )
flGuessed := 1
endif
enddo
enddo
RETURN
FUNCTION Read( cPrompt ) /* Simple read function */
RETURN __Accept( cPrompt )