
-----------------------------------
JR
Tue Feb 17, 2004 6:37 pm

Converting or to our help.
-----------------------------------
Ok so i was suppose to do a program that reads a word for example color and coverts it into canadain aka colour. now this is my program, but i get one error. when i type "color" it outputs lour. any way to fix that?
var word, z : string
var i : int
var x : int := 2
put "Enter a word of your choise "
get word
i := length (word)-1
z := word (* -2) + "our"
if word (* .. i) = "or" then
    put z
end if
put z


-----------------------------------
Paul
Tue Feb 17, 2004 6:58 pm


-----------------------------------
uh, I don't get it? what are you trying to do? Use it only on Colour?

var word, z : string 
var i : int 
var x : int := 2 
put "Enter a word of your choise " 
get word 
i := length (word)-1 
z := word (1..4)+word(*)
 
put z 


-----------------------------------
JR
Tue Feb 17, 2004 7:09 pm


-----------------------------------
no i mean you write a word. if that words end with "OR" the program needs to change it to "our". i just made colour as an example

-----------------------------------
Paul
Tue Feb 17, 2004 7:17 pm


-----------------------------------
oh I see, you'd need something like this then

var word: string
get word
if word ((length(word)-2)..*)="our" then
word:= word(1..(length(word)-2))+"r"
end if
put word


-----------------------------------
jonos
Tue Feb 17, 2004 9:52 pm


-----------------------------------
paulbian got it backwards, this is what it should be:

var word: string 
get word 
if word ((length(word)-1)..*)="or" then 
word:= word(1..(length(word)-1))+"ur" 
end if 
put word
