-2

How can i implement "Big-Integer" for c/c++ programming? Is there any build function in c/c++ library? or do I have to implement the Function for it?

{  
  BigInt fac=1;
  int value=25;
  for(int i=1;i<=25;i++){
    fac=fac*i;
  }
  cout<<fac<<endl;
}

I am trying like this but seems like there is no data type like "Big Int" .

πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190
  • 2
    There's no such thing like a c/c++ language. What made you think, there should be a datatype like `BigInt`? The standards don't provide one. You may lookup finding libraries supporting such though. But asking to recommend one is OT here. – πάντα ῥεῖ Sep 05 '15 at 17:51
  • 1
    Programming by guessing (at datatypes and _languages_) is not usually effective :) – Lightness Races in Orbit Sep 05 '15 at 18:32

2 Answers2

1

You can use boost::multiprecision::cpp_int if you need an arbitrary precision integer. If you need it to be fast, you can use boost::multiprecision with linking to one of several options of an external back-end.

Chris Beck
  • 15,614
  • 4
  • 51
  • 87
0

Using a array to store the single integers at a time will help you achieving the desired effect! This is the one of the best tutorial from codechef for this well known big-int problems!

Hope that helps!

Sagar Kar
  • 177
  • 1
  • 2
  • 10