Ask your own question, for FREE!
Computer Science 21 Online
OpenStudy (anonymous):

Here's a programming task, to be done in your language of choice: Write a function that takes a base-10 integer (don't worry about the sign) as input and outputs a string that is the English sentence for the number: int_to_word(7919) -> seven thousand nine hundred nineteen

OpenStudy (anonymous):

bonus if you make it work for negative numbers. bonus if you make it work for fractions like 51.2202 bonus if you make it work with arbitrarily long numbers like some huge factorial.

OpenStudy (anonymous):

if you enter 7919 in your code, i doubt you will get seven thousand nine hundred nineteen

OpenStudy (anonymous):

sorry i didn't saw that thing , i'm just gonna take it off and post it later on after correction.

OpenStudy (anonymous):

nobody wants to do it? :( I'll get to it myself

OpenStudy (anonymous):

i will do it sometime later :D

OpenStudy (anonymous):

http://ideone.com/nOnzN Now if anyone can help me debug it :-D

OpenStudy (anonymous):

http://ideone.com/gAjDN

OpenStudy (anonymous):

Found the bug, replaced || by && in the getstring() procedure and now it works fine. http://ideone.com/NP9ZE

OpenStudy (anonymous):

http://ideone.com/oI2rZ#

OpenStudy (anonymous):

http://ideone.com/NHiTY

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!