
-----------------------------------
scorpion1087
Tue Nov 11, 2003 12:53 pm

book ends
-----------------------------------
a book end is when you take a letter in a word and stop the word when you see the letter again. then show whats in the middle.

science-take the "C" therefore the word would be "cienc"
a skeleton for this would be great, thanks

-----------------------------------
Tony
Tue Nov 11, 2003 7:00 pm


-----------------------------------
umm... just use substrings to read each letter at the time. Maybe this will help?

var word:string := "science"

for i:1..length(word)
put word(i)
end for


-----------------------------------
Dan
Tue Nov 11, 2003 7:12 pm


-----------------------------------
he is a fast thing i made up


var worad : string
var letter : string
var newString : string := ""
var flag : boolean := false
var num : int := 0

put "put in wroad"
get worad

put "what letter to use for book end?"
get letter


loop
    num += 1

    if flag then
        newString += worad(num)
    end if
    
    if worad (num) = letter and flag = false then
            flag := true
            newString += letter
    elsif worad(num) = letter and flag then
            exit
    end if 
    
    if num = length (worad) then
        exit
    end if
end loop

put ""
put "output: ", newString


you have to use substrings to readed each letter of the worad. this verson still has a few bugs but should give you an idea on how to do it
