• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem on number to alphabet conversion  RSS feed

 
sachin yadav
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

i was tring to figure out a problem which is:- if we had anumber like 123 then it must be converted to one hundred twenty three. though i figure it out it seems to be very less efficient and clumsy. can smbody give me an idea to make it in a good way, which looks more arranged and object oriented.

regards,

Sachin.
 
Mani Ram
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Post what ever you have done so far. People will help you in making the code better.
 
sachin yadav
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
main acctually i have just test my program, but it's not working properly, so i have decided to make it again frm scrach with sm new logic. now can sm1 help me out. previously i make an array of string like one, two, three ect. til nine and use it to genetrate value. but wht abt ten twenty, and many things like that.

i think i am confused, can smbody make a better approach.
 
Jan Groth
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i fnd ths msgs pr8ty hrd 2 read...

is it such a big timesaver for you to write some1 instead of someone? many people here are non-native speakers and find this pretty hard to read.

and to be honest - some of the worst abbrevation-users in this forum are doubling as worst english writers, which makes it extra hard to read... :-(

many thanks,
jan
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Up to 20 or maybe from 10 to 20 you pretty much have to code as special cases. After that you can use modulo and division or just substringing to break out the tens, hundreds, thousands and so on, just as you would do using pencil & paper to write numbers. Share what you have with us and we'll be glad to see if we can help.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!