[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Daniel Kindler

8/20/2008 11:27:00 PM

okay, so in the book im reading it wanted me to do 2 things



1) wanted me to make a method for sorting a list of words

this is what i got now

def arange
arr = []
puts arr.sort.join(', ')
word = gets.chomp
while word != ""
arr << word
word = gets.chomp
end
end

arange

why isnt it working?




2) It wants me to make and "old school roman numerals" thing

so if i put a number it, it would return it in roman numerals, but NOT
subtraction
so like 4 would be IIII , not IV


IM CONFUSED WITH THAT!!! any body can give me a little hint on how to
start?
thx
--
Posted via http://www.ruby-....

3 Answers

botp

8/20/2008 11:52:00 PM

0

On Thu, Aug 21, 2008 at 7:27 AM, Daniel Kindler <gizabo@yahoo.com> wrote:
> IM CONFUSED WITH THAT!!! any body can give me a little hint on how to start?


start here http://pine.fm/Learn...

Daniel Kindler

8/21/2008 12:14:00 AM

0

botp wrote:
> On Thu, Aug 21, 2008 at 7:27 AM, Daniel Kindler <gizabo@yahoo.com>
> wrote:
>> IM CONFUSED WITH THAT!!! any body can give me a little hint on how to start?
>
>
> start here http://pine.fm/Learn...

that was helpful
--
Posted via http://www.ruby-....

Victor Reyes

8/21/2008 1:44:00 PM

0

[Note: parts of this message were removed to make it a legal post.]

On Wed, Aug 20, 2008 at 7:27 PM, Daniel Kindler <gizabo@yahoo.com> wrote:

> okay, so in the book im reading it wanted me to do 2 things
>
>
>
> 1) wanted me to make a method for sorting a list of words
>
> this is what i got now
>
> def arange
> arr = []
> puts arr.sort.join(', ')
> word = gets.chomp
> while word != ""
> arr << word
> word = gets.chomp
> end
> end
>
> arange
>
> why isnt it working?
>
>
Daniel,

I am not sure if your comment: "that was helpful" was meant to be sarcastic
or if you really found the link helpful.
However, if you if you still needs help, see below:

I am no Ruby expert but I re-arranged your code and it works:

def arange
arr = []
word = gets.chomp
while word != ""
arr << word
word = gets.chomp
end

puts arr.sort.join(', ')

end
arange

ruby mypgm.rb

orange
banana
Apple
Banana
Cherries
mango

Apple, Banana, Cherries, banana, mango, orange



>
>
>
> 2) It wants me to make and "old school roman numerals" thing
>
> so if i put a number it, it would return it in roman numerals, but NOT
> subtraction
> so like 4 would be IIII , not IV
>
>
> IM CONFUSED WITH THAT!!! any body can give me a little hint on how to
> start?
> thx
> --
> Posted via http://www.ruby-....
>
>
For your second question I also find it confusing. But you can find many
examples on the web, *google*, about playing with roman numerals.