Author |
Message |
JR
|
Posted: Tue Feb 17, 2004 6:37 pm Post subject: 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?
code: | 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
|
|
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
Paul

|
Posted: Tue Feb 17, 2004 6:58 pm Post subject: (No subject) |
|
|
uh, I don't get it? what are you trying to do? Use it only on Colour?
code: |
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
|
Posted: Tue Feb 17, 2004 7:09 pm Post subject: (No subject) |
|
|
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

|
Posted: Tue Feb 17, 2004 7:17 pm Post subject: (No subject) |
|
|
oh I see, you'd need something like this then
code: |
var word: string
get word
if word ((length(word)-2)..*)="our" then
word:= word(1..(length(word)-2))+"r"
end if
put word
|
|
|
|
|
|
 |
jonos

|
Posted: Tue Feb 17, 2004 9:52 pm Post subject: (No subject) |
|
|
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 |
|
|
|
|
 |
|