如何将两个大数乘以字符串&输出也应该是字符串。 [英] How can I multiply two Large Numbers given as string & output should also be string.

查看:85
本文介绍了如何将两个大数乘以字符串&输出也应该是字符串。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Plz告诉我如何将两个以字符串类型给出的大数相乘。输出应该是字符串..

解决方案

请参阅我对解决方案1的评论。使用字符串进行数字表示,具有明显的吸引力,不是很好理念。更好的概念仍然使用数组,但是使用按位数字表示,每个整数只有无限大小的数据。



C ++解决方案确实存在。你可以在这里找到一些: http://bit.ly/1ffTUX3 [ ^ ]。



-SA


我假设大你的意思是大,标准类型(int,double,....)无法处理它....



1.)我想要记住,.net中有类似通用类型的东西来处理这样的事情。但请参阅2.)



2.)自己动手。

这是一个很好的任务,可以熟悉您的编程语言。



 12345 x 6789 
------------
33945
..... 6
.........
=============
83810205







手动解决,识别手动解决方案所需的步骤,然后对其进行编程;)


Plz tell me how can I multiply two large numbers which is given as string type. And the output should be string..

解决方案

Please see my comment to Solution 1. Using strings for numeric representation, with all its apparent attractiveness, is not a very good idea. Better concept still operates with arrays, but with bitwise numeric presentation, only of unlimited or big size of data per each integer number.

C++ solutions do exists. You can find some here: http://bit.ly/1ffTUX3[^].

—SA


I assume with "large" you mean that large, that Standard types (int, double, ....) can not handle it....

1.) I think to remember, that there is something like a "generic" type in .net to handle something like this. But see 2.)

2.) Do it by yourself.
This is a nice task to get familar with your programming language.

12345 x 6789
------------
       33945     
     .....6
.........
=============
    83810205




Solve it "manually", recognize the steps you need for the "manual" solution and then program it ;)


这篇关于如何将两个大数乘以字符串&输出也应该是字符串。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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