如果我输入"1",如何打印字符串如果我输入"15",则打印“一个".如果我输入"123",则打印“十五"然后打印"123" [英] how to print string, if i input "1" then print "One", if i input "15" then print "fifteen", if i input "123" then print "one hundred and twenty-three "

查看:122
本文介绍了如果我输入"1",如何打印字符串如果我输入"15",则打印“一个".如果我输入"123",则打印“十五"然后打印"123"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何打印字符串,如果我输入"1"然后打印一个",如果我输入"15"然后打印十五",如果我输入"123"然后打印"123" class ="h2_lin">解决方案

如果要在控制台中显示"它,请使用:

 字符串 Number = Console.readLine();
然后是一些if问题,例如:

如果(Number.Equals(" )){
Console.WriteLine(" )
}

如果(Number.Equals(" )){
Console.WriteLine(" )
} 


or with a switch case :D


我想不出另一种可能的方法

但是在我的大脑深处,有一个念头,说有一个人对其进行了硬编码...
他补充说,总是读第一个数字,例如900,所以它的九个数字
然后他计算了之后的数字...大概...如果您用谷歌搜索它,一定会找到它的:D


现在我们正在做您的整个家庭作业!
参见此处:将数字转换为等效词. [ ^ ]


http://stackoverflow.com/questions/2729752/converting-numbers-in-to-words-c-sharp [ http://social.msdn.microsoft.com/论坛/nb-NO/csharpgeneral/thread/0b1dec9c-61e9-4544-8134-bda1264a21a4 [ http://www.c-sharpcorner.com/UploadFile /b942f9/converting-numbers-to-words-in-C-Sharp/ [
解决方案

If you want to "show" it in a Console so just use:

string Number = Console.readLine();
and then some if-questions like:

if(Number.Equals("1")){
Console.WriteLine("one")
}

if(Number.Equals("123")){
Console.WriteLine("onehundreed and twenty-three")
}


or with a switch case :D


i cant think of another possible Method

but deep in my brain theres a thought that there was a guy who hardcoded it ...
he added always read the first number like in 900 so its nine
and then he counted the numbers after that ... or so... if you google it im sure you will find it :D


Now we are getting into doing your whole home work!
See here:
Converting numbers to the word equivalent. [^]


http://stackoverflow.com/questions/2729752/converting-numbers-in-to-words-c-sharp[^]
http://social.msdn.microsoft.com/Forums/nb-NO/csharpgeneral/thread/0b1dec9c-61e9-4544-8134-bda1264a21a4[^]
http://www.c-sharpcorner.com/UploadFile/b942f9/converting-numbers-to-words-in-C-Sharp/[^]


这篇关于如果我输入"1",如何打印字符串如果我输入"15",则打印“一个".如果我输入"123",则打印“十五"然后打印"123"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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