I would like to make my program calculate this:
but the answer is too big, but there must be a way to calculate this in my program...Code:cout <<(long double)pow((long double)2,2005)<<endl;
I would like to make my program calculate this:
but the answer is too big, but there must be a way to calculate this in my program...Code:cout <<(long double)pow((long double)2,2005)<<endl;
You could consider using the GNU MP library.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
tere
i wrote a program to deal with huge numbers a while ago. it's not hard to do this. to write a pow() just write a multiplication function and use it in a loop, it would be slow, yes, but it will get the job done.
:wq
I agree, but it can be tedious if you're working on something else and just need bignum support. Not only that, but it isnt easy to make it run (relatively) fast.it's not hard to do this.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
yes, you are right, laserlight. if he's working on something else, then it really isn't necessary, but if it's just a hobby project why not...Originally Posted by laserlight
:wq
Displays 0:
Code:#include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) { int slow=2; for(int road=1;road<2005;road++){ slow=slow*2; } cout<<slow<<endl; system("PAUSE"); return EXIT_SUCCESS; }