Computer Science Canada

Only Numbers

Author:  CyCLoBoT [ Tue Feb 11, 2003 4:14 pm ]
Post subject:  Only Numbers

How can I restrict in Turing so that the user can only enter numbers? Also the user can use backspace as well

Thanks

Author:  Catalyst [ Tue Feb 11, 2003 5:18 pm ]
Post subject: 

code:

var dir : string (1)
loop
    getch (dir)
    if index ("0123456789", dir) not= 0 or dir=chr(8) then
        put dir ..
    end if
end loop

Author:  CyCLoBoT [ Tue Feb 11, 2003 5:40 pm ]
Post subject: 

This is exactly what I wanted. Thanks for your help Catalyst Smile


: