
-----------------------------------
ToTNuim
Sat Mar 13, 2010 11:41 am

Using parameters -- Infinite Loops
-----------------------------------
For some reason, my code does not accept the parameters (20, 200) or any parameter that's not (negative, positive) and will go into a infinite loop.
Please help!
I just started computer science and I don't know how to "look for problems" in codes!


function getInteger (low, high : int) : int
    const ENTER : char := chr (10)   
    var ch : string (1) := 'x'       
    var number : int := 0
    var digits : int := 0
    var Negative : boolean := false

    put "Please enter an Integer between ", low, " and ", high, " : " ..
    loop
        loop
            if hasch then
                getch (ch)
                if ch >= '0' and ch = low and number = 9 and number >= low and number 