an unsigned long long int would give you a 64bit number. That's only enough to store 10^19 not 10^20 (actual length is: 18446744073709551616 or 2^64)
if you REALLY need VERY alrge numbers, there's a litte trick you could use....but still I find it weird that you need bigger then 64bits integers...maybe that if you explain a little more your problem, we could help better... hmm, how could I explain... Build an object that has a pointer to the last object created. Each object has a variable with 1 number in it. Auto-create has many objects as you need to get your very large number....though with this technique, you will need lots of memory and it will be slow to access...
or you could do a mantissa/sig fig thing...its a trick a lot of apps use (i know nvidia uses it for hdr) to get more value out of an int (or long) while sacrificing minimal accuracy. EX: first 5 bytes (bits?) represent the number, last 3 are the exponent. so 10010101 is 10010|101 is 18^5 is 1889568. Feel free to correct me if im wrong.
you could probably program a way to use 2 sperate long values to gether to store large number.... for example, varibles A and B, lets assume that each one takes 3 digits and u want to store a 6 digit number in them (123456), you could save 123 in variable A and 456 in variable B
yea, but then how do u recompose the number to perform arithmetic on it??? there has to be another way... http://www.thecodeproject.com/cpp/largenumber.asp I dunno how it works - but it looks kool
Actually you can store that in long double That really would'nt be an integer but you can still get very accurate values. try printing it with: cout << setiosflags(ios::fixed) << 10^20 << endl;
Absolutely!!!! I have a program that uses linked list to calculate factorials. Want to see factorial of 700 ?? 2422040124750272179867875093812352218590983385729207299450679664929938160215647420444519051666484819249321456671497049842327525093874817343838393757631459228450828499972271274140160311057830558463636337124079332447820739281101037112665387537180790257577919273108262916904750405235055060084012219492892375635136296622020023178109619818046179906897450420548912610870589088056503913584562211037693288782960900195074130999799035970711436279339094292032866260496375825461427727555710003007752906141470639574390024988514914264449865006458873226951941899545970333910351588559232940829569276986080222200289966128343931630028789203382654749603473516314765262772257171154686716862814184728741187147936349501653197457455660413134506049122044947052623384682088864790673309569292384215611788014274954905914148362303226200246816441301934846080254998647325270606104512088058712293349862185399243309054299576381718806247238195232604642614329894070636163753672091232751612378348273840757873567717532879242518337119540602943609411629349009566043720836737401090882392975031224612531245642687296717053747734506443314924558119560479901478736209556925161517737110399754730551854066328420014728657896286936523787080206476327157136441318773432751007263108056958251693811280957243202460157111778617472683761623869704457588005158037495665069625778930898095725794710701639238231528115579619120287378689238934335198508665933917257143975277707590597511989345068701735940169672561864713107115016747368992690116082633762172346688969840862517264384000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Nice job bakuryu ... but what if the user wants to enter a number that's itself cant be defined using standard data types ??? PS : the input could be the factorial of 700 !! whoa
See the code I have written can even find the factorial of factorial of 700. Only there will me insufficient memory!! And you wantto know how can take the input of lagre numbers.......... Won't be telling you but what you need is :- friend istream& operator >> (istream&,LinkedList& ) ; void addAtHead();