+ 1

Multiplying large numbers?

https://code.sololearn.com/cdXr7GI7JDu0/?ref=app How can I make this code spit out a hundred digit integer properly? If you have a better method of doing so, share it, but for clarification, I'll tell you what this function should do: The function should generate a random number with as many digits as the number in the parameter. So if the param is 5, it'll generate a 5 digit random number. The problem is when the parameter is a large number, in my example I used 100. I tried using 1LL but it didn't work.

4th Mar 2019, 11:39 PM
Daniel Cooper
Daniel Cooper - avatar
3 ответов
+ 2
Does digit by digit work by you? Then randomize digits and output them one after another as an array or string. If you need to calculate with such a number, you'd have to write a code that does it (integer) digit by digit, like in elementary school on paper. One related example of my own: https://code.sololearn.com/cV3o3NWxVZ11/?ref=app
5th Mar 2019, 12:23 AM
HonFu
HonFu - avatar
+ 1
I was hoping to store it as a single int, as I could easily do it using a vector. Lol
5th Mar 2019, 1:08 AM
Daniel Cooper
Daniel Cooper - avatar
+ 1
A promising keyword for googling what's out there would be 'big num C++'.
5th Mar 2019, 1:11 AM
HonFu
HonFu - avatar