
-----------------------------------
Jas
Sun Mar 20, 2005 10:19 pm

help: inputting fixed # of characters for integers
-----------------------------------
I am doing a big program in turing for school and i need help. How do u make a program so the user inputs a fixed number of characters for integers. For example, you can do this for a string by:

var code : string (9)
var familyCode : string (2)
var productCode : string (4)
var supplierCode : string (2)
var locationCode : string (1)

but if u do this...

var code : int (9)
var familyCode : int (2)
var productCode : int (4)
var supplierCode : int (2)
var locationCode : int (1)

the program crashes.

Also, how do u search for a pattern in an integer. If you declard the code variables as integers, and u try to do the following, the program crashes:

familyCode := code (1 .. 2)
productCode := code (3 .. 6)
supplierCode := code (7 .. 8)
locationCode := code (9 .. *)

How do u search for a pattern if it is an integer?

-----------------------------------
Cervantes
Sun Mar 20, 2005 10:36 pm


-----------------------------------
For the first question:

var num := ""
var input : string (1)
var numOfDigits := 7
loop
    getch (input)
    exit when input = "\n" %exit when enter is pressed
    if strintok (num + input) and length (num + input) 