把数字转换成单词,怎么样? [英] Converting number into word, how??
本文介绍了把数字转换成单词,怎么样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
坦率地说,我没有关于此的代码。我不知道如何开始。这应该是:
如果用户输入1,则输出是其对应的单词one。
我需要一些帮助!
Frankly speaking, I have no code about this. I don''t know how to start. This should be:
If the user inputs 1, the output is its corresponding word "one".
I need some help!
推荐答案
坦率地说,我没有关于此的代码。我不知道如何开始。这应该是:
如果用户输入1,则输出是其对应的单词one。
我需要一些帮助!
Frankly speaking, I have no code about this. I don''t know how to start. This should be:
If the user inputs 1, the output is its corresponding word "one".
I need some help!
您需要先获得一些代码才能获得代码帮助。首先记下你的算法。您可能需要使用%运算符。
You need to have some code first to get code help. Write down your algorithm first. You may need to use the % operator.
您需要先获得一些代码才能获得代码帮助。首先记下你的算法。您可能需要使用%运算符。
You need to have some code first to get code help. Write down your algorithm first. You may need to use the % operator.
我现在有我的代码,但问题是:如果用户输入1500,输出不是一千五百,而是1500和1五百......我缺少什么?这是代码
I have now my code, but the problem is: if the user inputs "1500" the output is not "One Thousand Five Hundred", but "1500"and "1Five Hundred"...What is my lacking?? Here''s the code
展开 | 选择 | Wrap | 行号
哇这个代码是一个恶梦!您遇到的问题是因为您的代码不可读,维护起来也很困难,如果我要输入3000或4000甚至10000,那该怎么办。您必须想到一个更优雅的解决方案来解决这个问题如果你喜欢的话。如果您的设计更好,您的问题就会自行解决。
Woah this code is a nightmare! The problem you are having is because your code is unreadable, it is also going to be very difficult to maintain, what if I was to input 3000 or 4000 or even 10000. You must think of a much more elegant solution to this problem then massive ifs like you have. When your design is better your problem will fix itself.
这篇关于把数字转换成单词,怎么样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文