如何用文字打印数字? [英] how to print the numbers in words?

查看:186
本文介绍了如何用文字打印数字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好今天(2006年7月9日)我参加了针对aspire系统的技术访谈。两轮技术面试。我在第一轮就做得很好而在另一轮做得不好。


面试官让我写一个程序打印并用文字给出数字......例如说...如果输入 12345 然后输出应打印为一万二千三百四十五。谁能帮助我如何在c中为此编写程序。等待回复。谢谢你。

解决方案

你好


这个问题很酷。


你可以用这种方式分割数字。(我的意思是首先确定最后一次的数字并继续下去大约一千个)


这里是代码

展开 | 选择 | Wrap | 行号



嗨今天(2006年7月9日)我参加了对向系统的技术访谈。两轮技术面试。我在第一轮就做得很好而在另一轮做得不好。


面试官让我写一个程序打印并用文字给出数字......例如说...如果输入 12345 然后输出应打印为一万二千三百四十五。谁能帮助我如何在c中为此编写程序。等待回复。感谢您。





我认为面试官会要求你为这个问题提供逻辑becoz在面试室内写下程序这是非常困难的,无论如何我给的程序,你只需复制它,粘贴并运行,它就可以工作。

展开 | 选择 | 换行 | 行号


展开 | 选择 | Wrap | 行号

Hi today (9th july 2006) i attended a technical interview in aspire systems. Two rounds of technical interviews. i well in the first round and did bad in the other.

The interviewer asked me to write a program to print and given number in words... say for example... if the input is 12345 then the output should be printed as "twelve thousand three hundred and fourty five" can someone help me how to write a program for this in c. waiting for the reply. thanking you.

解决方案

hi there

well this problem is quite cool.

Well u can split the number this way.(I mean first determine number at the last at once place and proceed down last thousand or so)

here is the code

Expand|Select|Wrap|Line Numbers


Hi today (9th july 2006) i attended a technical interview in aspire systems. Two rounds of technical interviews. i well in the first round and did bad in the other.

The interviewer asked me to write a program to print and given number in words... say for example... if the input is 12345 then the output should be printed as "twelve thousand three hundred and fourty five" can someone help me how to write a program for this in c. waiting for the reply. thanking you.


Hi,
I think the interviewer would have asked you to give the logic for this question becoz writing the program inside the interview cabin for this is very difficult, anyway I am giving the program, you just copy it and paste and run, it will work.

Expand|Select|Wrap|Line Numbers


Expand|Select|Wrap|Line Numbers


这篇关于如何用文字打印数字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆