Conver数字成字 [英] Conver number into word

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

问题描述

你好,



我需要一个c ++程序,它从1到999取整数输入值并显示它的字。例如,如果用户输入358,则输出应为三百五十八。



提前感谢。

Hello,

I need a c++ program that take an integer input value from 1 to 999 and display its word. For example if the user enter 358 then output should be "Three hundred and fifty eight".

Thanks in advance.

推荐答案

Google [ ^ ]无法正常工作?
Google[^] not working where you are?


看起来应该是这样的:





Should look something like this:


int main()
{
cout<<"Enter an integer between 1 and 999\n";
int a;
cin>>a;

if (a==1)
{
cout<<"One\n";
}
else if (a==2)
{
cout<<"Two\n";
}
else if (a==3)
{
cout<<"Three\n";
}
// else if... repeat till 999
}


如果有人,您认为如何学习?你还做功课吗?
What do you think to learn if someone else does your homework for you?


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

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