
-----------------------------------
aliveiswell
Mon Jan 12, 2004 5:45 pm

removes 4 letter words
-----------------------------------
this was the final test for some of the people in my class. it's pretty simple but im proud of it. it removes all 4 letter words from a sentence.


var sentence : string

put "This program will remove all 4 letter words from a sentence."

loop
    put ""
    put "Please enter your sentence:"
    get sentence : *

    if length (sentence) > 80 then
        put "That sentence is too long, please type another sentence."
    else
        if sentence = "exit" then
            exit
        end if

        sentence := " " + sentence + " "
        put sentence

        var words : array 1 .. length (sentence) of string
        for counter : 1 .. length (sentence)
            words (counter) := sentence (counter)
        end for

        for counter : 2 .. length (sentence)
            if counter = 2 and sentence (counter) = " " then
            elsif counter = 3 and sentence (counter) = " " then
            elsif counter = 4 and sentence (counter) = " " then
            elsif counter = 5 and sentence (counter) = " " then
            elsif sentence (counter) = " " and sentence (counter - 5) = " " and sentence (counter - 4) not= " " and sentence (counter - 3) not= " " and sentence (counter - 2) not= " " and
                    sentence (counter - 1) not= " " then
                words (counter - 4) := "*"
                words (counter - 3) := "*"
                words (counter - 2) := "*"
                words (counter - 1) := "*"
            end if
        end for
        for counter : 1 .. length (sentence)
            put words (counter) ..
        end for
    end if
end loop
put "You have exited..."


-----------------------------------
Cervantes
Mon Jan 12, 2004 6:00 pm


-----------------------------------
cool idea, kinda pointless :P  interesting though :D

-----------------------------------
Tony
Mon Jan 12, 2004 6:18 pm


-----------------------------------
i remember doing something like that a long while back... I think the story behind the program was to sensor a certain 4 letter word, but since it can easily be modified, they desided to just sensor all 4 letter words :lol: Doesn't really solve the problem though :lol:

-----------------------------------
shorthair
Fri Jan 23, 2004 10:21 am


-----------------------------------
Ummmm your proram is good at what it does ,  :D , BUt you could probably mod that to censor out an array of words , so that it could actually be used for censor ship , but then you run into words spelt in spaces , G A * , and not even compsci has been able to * that out yet, id like to see a good censorship APP , it  would actually be quite useful to me , as i do a bit of editing online

-----------------------------------
Tony
Fri Jan 23, 2004 3:07 pm


-----------------------------------
well as long as an app is sensoring, there will always be a way around it :?

5uch 45 1337 5p34k, sensor that :lol:

heh, the only way I suppose would be to sensor everything that is not part of the dictionary of allowed words :shock:

-----------------------------------
Maverick
Fri Jan 23, 2004 3:09 pm


-----------------------------------
Y35 7H47 15 4 G00D 1D3A!

-----------------------------------
Andy
Fri Jan 23, 2004 5:24 pm


-----------------------------------
u should've used index

-----------------------------------
sport
Fri Jan 23, 2004 7:12 pm


-----------------------------------
If getting the sentence from a file you can use length command.

var fileno:int
var filename:string:="NAME"
var word:string
loop
get :fileno,word
if length(word) not =4 then
esle
put word
end if
end for


-----------------------------------
sport
Fri Jan 23, 2004 7:13 pm


-----------------------------------
You will need a file called NAME in order for the program to work.

-----------------------------------
jonos
Mon Jan 26, 2004 10:51 am


-----------------------------------
You could have just concatenated the different parts together at each new space, and not used an array.
