Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please i need a C++ code solution for this question E. Biglnteger Class-Factorial (4049) Description Use Biginteger to give out the exact value of factorial
please i need a C++ code solution for this question
E. Biglnteger Class-Factorial (4049) Description Use Biginteger to give out the exact value of factorial value, like 100 ! Or 200!. In c or C++, number of data type int or long is limited in value. The largest number it can represent is 231 or 263. It cannot exactly represent very big integers, like 100 ! or 12345678901234567890 . So we use an array to representing the big integers. Each element of that array holds each digit. For example, suppose we use this method to represent a big integer like 12345. Suppose the array is a[1000]. Then we represent it this way: a[0]=5;a[1]=4;a[2]=3;a[3]=2,a[4]=1, all other element is 0 . The lowest decimal places is at a[0]. So we define a class for Biginteger like this way: Suppose the decimal digits is no more than 10000. In this class, we also provide 3 member methods for you. One is input a big integer from keyboard, it needs calling Reverse() to reverse the input sequence. So that lowest decimal digit is put at index 0 , the highest decimal digit is put at the high index position. For example, if we enter by keyboard a big integer like 12345 . Then it will save like this way a[0]=5;a[1]=4;a[2]=3;a[3]=2,a[4]=1. const int MaxLen =10000; class Biglnteger \{ int arr[MaxLen]; int len;// actual digit number public: Biginteger ( ):len (0){} friend ostream \& operator ( (istream \& in, BigInteger \& b); void Reverse(); }; void Biginteger::Reverse() { int i=0,j=len1; while (i=0;i) out ( istream \&in, Biginteger \&b) { char c; while ((c=in.get ())&&(c>=0&&c>(istream \&in, BigInteger \&b); void Reverse(); }; void BigInteger::Reverse() { int i=0,j=len1; while (i=0;i) out (istream \&in, Biginteger \&b) { char c; while ((c=in.get ())&&(c>=0&&c>n; b1.Createfromfactorial();///create n ! cout; ? Input Enter n in one line. n is no more than 500 . Output Output the result in one line without any space. Enter n in one line. n is no more than 500 . Output Output the result in one line without any space. ExamplesStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started