C#中有理数的乘法 [英] Multiplication of rational numbers in c#
本文介绍了C#中有理数的乘法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hiiii.
我不想对有理数两个数相乘
例如:-4.5 X 0.5
我有两个文本框,在上面输入了任意数字,在第三个文本框获得了答案..
需要帮助!!
Thanxx ..
问候
Husi.Mak
Hiiii.
I wnt to perform multip[lication of two number which are rational numbers
for Example :- 4.5 X 0.5
i am having two textbox in which the above any number is entered and the answer in obtain in 3rd textbox..
Need Helpp!!
Thanxx..
Regards
Husi.Mak
推荐答案
哪个部分让您感到困惑?您可以使用double.tryparse从文本框中获取双精度,并使用结果上的tostring方法获取第三个文本框的字符串
Which part is confusing you ? You can use double.tryparse to get doubles out of the text box and the tostring method on the result to get a string for the third textbox
您实际上应该阅读Microsoft的文档,它们始终给出用法示例:
http://msdn.microsoft.com/en-us/library/994c0zb1.aspx [ ^ ]
You should reallyt read the documentation from Microsoft, they always give examples of usage:
http://msdn.microsoft.com/en-us/library/994c0zb1.aspx[^]
如果您确实需要将理性数字相乘,则必须实现一个表示此类数字的类.您可以看看这篇CodeProject
文章:有理数-.NET 4.0版本(理性计算1) [ ^ ].
If you really need a multiplication of rational numbers then you have to implement a class representing such numbers. You may have a look at this CodeProject
article: Rational Numbers - .NET 4.0 Version (Rational Computing 1)[^].
这篇关于C#中有理数的乘法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文