
-----------------------------------
chibitenshi_03
Sun Feb 01, 2004 9:46 pm

How to reverse word? help ASAP
-----------------------------------
How do i make a program that ask the user to input a word and then output the word backwards like cow would be woc?

Time to enforce my rules, Topic Locked, also, subtracted bits from anyone I deem that was spamming. Oh, btw, I will be taking 100 bits, so people would remember, oh and the 100 bits are per post.

-----------------------------------
Paul
Sun Feb 01, 2004 9:51 pm


-----------------------------------
Use the "length" command.

var word: string
put "Please enter word: "..
get word
for decreasing a:length(word)..1%runs a counted loop to the number of letters
put word(a)..%puts the word backwards, since the value a decreases.
end for


-----------------------------------
shorthair
Sun Feb 01, 2004 9:53 pm


-----------------------------------
paulibians way is what were gonna use , i posted mine but i had it much more complicated , well done paul ,

-----------------------------------
Paul
Sun Feb 01, 2004 9:54 pm


-----------------------------------
Um, if he is having trouble with this, lets try to help him with simple stuff eh?

-----------------------------------
chibitenshi_03
Sun Feb 01, 2004 9:57 pm


-----------------------------------
lol thanks for the help i really appreciate it and also i'm a girl! ^^

-----------------------------------
chibitenshi_03
Sun Feb 01, 2004 10:01 pm


-----------------------------------
The other part of the program is if a word is a palindrome i need to put this is a palindrome. How do i check if it is or not?

-----------------------------------
Paul
Sun Feb 01, 2004 10:03 pm


-----------------------------------
:?  why does this remind me of my compsci class?

I'd use the above program to reverse the word, then use a variable to hold that word, and compare it to the original word. I hope you know how to do this, if not, just post.

-----------------------------------
we64
Sun Feb 01, 2004 10:12 pm


-----------------------------------
this was one of my assigment... so here

var word, backword : string := ""
put "Please enter a word: "
get word

for decreasing a : length (word) .. 1
    put word (a) ..
    backword := backword + word (a)
end for

if backword = word then
    put "This word is a palindrome."
else
    put "This word is not a palindrome."
end if

-----------------------------------
Paul
Sun Feb 01, 2004 10:14 pm


-----------------------------------
Tony! how would Shantz like it if you did that to... um.. you know who.

-----------------------------------
we64
Sun Feb 01, 2004 10:21 pm


-----------------------------------
who cares, shanz does not care... :lol:  :lol:

-----------------------------------
shorthair
Sun Feb 01, 2004 10:23 pm


-----------------------------------
I thikn everyone does those bad boy assignements , i remember them from way back when in grade 10 , i loved gradde 10 compsci , liek the first day we started i thought  i was so cool made a simpsons quiz with just straight if statements , it rocked ,but we64 , thats like a carbon copy of mine , i did the exact same thing

-----------------------------------
we64
Sun Feb 01, 2004 10:30 pm


-----------------------------------
shorthair, I never copyed yours, maybe we just had the same thought...

-----------------------------------
shorthair
Sun Feb 01, 2004 10:33 pm


-----------------------------------
dude i wasnt implying that , i never posted mine , i just found it funny how they are the same , sorry if it sounded wrong

-----------------------------------
jonos
Sun Feb 01, 2004 10:37 pm


-----------------------------------
im gonna kill my school or something, cause 90% of my class couldn't even use the length() function. you people are doing if statements on the first day, we didn't get to those until the middle of the semester. man, where do you people go to school, cause im gonna move...

anyways, paulbians is the best way, i also did a more complicated one, but...

-----------------------------------
we64
Mon Feb 02, 2004 7:34 am


-----------------------------------
oh sorry shorthair, I didn't know. but I don't think there is a easier way than our idea to find out of palindrome. Also, many people did the same in my class, even the teacher, so it is common to have the same idea...

-----------------------------------
Paul
Mon Feb 02, 2004 1:56 pm


-----------------------------------
Theres always an easier way, we can always learn from people more experienced than us.  :lol:

-----------------------------------
recneps
Mon Feb 02, 2004 3:41 pm


-----------------------------------
That's why we're here isnt it?

-----------------------------------
Andy
Mon Feb 02, 2004 4:33 pm


-----------------------------------
y dont u just change the original word by using a temporary char?
