mit-scheme-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MIT-Scheme-devel] Convert numbers to words


From: daZza92
Subject: [MIT-Scheme-devel] Convert numbers to words
Date: Tue, 8 Nov 2011 10:40:12 -0800 (PST)

Hey folks,

We just started with scheme at the university and I need some help doing my
task.

We shall write a program that translates numbers into words, e.g 1 to "one".
It must work for all numbers up to 10 ^ 9.
I've got no real clue how to do this... My basic idea would be to create
some sort of array or list where I define those numbers as words like this:


('ZERO',        0)
('ONE',         1)
('TWO',         2)
('THREE',       3)
('FOUR',        4)
('FIVE',        5)
('SIX',         6)
('SEVEN',       7)
('EIGHT',       8)
('NINE',        9)
('TEN',         10)
('ELEVEN',      11)
('TWELVE',      12)
('THIRTEEN',    13)
('FOURTEEN',    14)
('FIFTEEN',     15)
('SIXTEEN',     16)
('SEVENTEEN',   17)
('EIGHTEEN',    18)
('NINETEEN',    19)
('TWENTY',      20)
('THIRTY',      30)
('FORTY',       40)
('FIFTY',       50)
('SIXTY',       60)
('SEVENTY',     70)
('EIGHTY',      80)
('NINETY',      90)
('HUNDRED',     100)
('THOUSAND',    1000)
('MILLION',     1000000)
('BILLION',     1000000000)
('TRILLION',    1000000000000)
('QUADRILLION', 1000000000000000)

Then somehow check the input value with this list and substitute the numbers
with the words. But implementing this is giving me some trouble. Hope
someone can help :)

regards
daZza
-- 
View this message in context: 
http://old.nabble.com/Convert-numbers-to-words-tp32804329p32804329.html
Sent from the Gnu - MIT Scheme - Dev mailing list archive at Nabble.com.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]