
-----------------------------------
KukuriChan
Thu Feb 12, 2004 7:24 pm

HELP !!!Changing numbers to the order they come in alphabet!
-----------------------------------
I'm suppose to output the letter in our alphabet that falls in that order number if it was greater than 0. I have part of it but there's always a bug in the program if a digit was two digits. Can anybody fix it? 

 
  put "Please enter a word " ..
get word 
 for x : 1 .. length (word)
if strintok (word (x)) and strint (word (x)) not= 0 then
                put chr (strint (word (x)) + 96)
            else
                put "Sorry. Please try again. "
                exit
            end if
end for 


-----------------------------------
Paul
Thu Feb 12, 2004 7:27 pm


-----------------------------------
What do you want? post the whole program or something, Im not sure if your trying to add 96 to the ASCII value, if that you need to use ord.

-----------------------------------
Cervantes
Thu Feb 12, 2004 7:57 pm


-----------------------------------
var num : int
put "Please enter a number " ..
get num
put chr (num + 96)

four line program..  :roll:

I'm confused though, the program you posted indicates you want to input a word and output it in numbers.  the question however asks to input a number and output a word.  which do you want?? the above is an answer to the question

-----------------------------------
Cervantes
Thu Feb 12, 2004 8:01 pm


-----------------------------------
var word : string
put "Please enter a word : " ..
get word
for i : 1 .. length (word)
    put ord (word (i)) - 96, "  " ..
end for


there's the code for the other way.

NOTE: that code doesn't work for capital letters..  you can code that part yourself.

-----------------------------------
Andy
Thu Feb 12, 2004 9:22 pm


-----------------------------------
windsor eh? what school?

-----------------------------------
KukuriChan
Thu Feb 12, 2004 9:23 pm


-----------------------------------
Wow. You're four line program really worked. Thanks. ^^;;

-----------------------------------
Andy
Thu Feb 12, 2004 9:25 pm


-----------------------------------
vmss?

-----------------------------------
KukuriChan
Thu Feb 12, 2004 9:25 pm


-----------------------------------
Huh? Um... I go to Massey. Should I know you? I know a lot of people here go to/went to Massey.

-----------------------------------
Andy
Thu Feb 12, 2004 9:41 pm


-----------------------------------
ya i'm from massey... pm me ur name
