Not Yet Answered # very large number factorial

Labdabeta 182 jmichae3 -1 Need some help with this Array. I am trying to get the sum of the even numbers and the sum of the odd numbers using a for each loop. I know the answers to what I am trying to achive are sum of even = 84 and the sum of ...

0

Do not ask for code. Suggestions are fine. I would suggest using a 256-base system and store the digits in an std::string. Make this into a class with all the normal arithmetic operators defined. Next add a function called factorial (or maybe overload the ! operator?) and write the traditional factorial code there.

0

Hi all,

How i do the factorial very large number in c++ ..Please give me sugestion and code

thanks in advance

for very parge numbers, you should probably be using the GMP library for "bigint" types of numbers. those are not standard typews of integers, but are arrays of unsigned integers and one bit as the simulation of a sign bit where mathematical operations are done to simulate that the array is one large integer.

if you have ever done binary to hexadecimal conversion, it is the same type of math - the digits in each position are essentially like an unsigned integer in the array. got it? now you can make a class which does this called bigint. the tough part is going to be I/O, you are going to have to figure that part out. use your head.

by the way, there is a "bitset" collection template type in the standard c++ library which may prove useful - and there is a dynamic bitset type in Boost. but the types of math ops available aren't too promising.

if you don't want to go in any of these directions, use the type

long long

or

__int64 (microsoft and embarcadero compilers)

or

#include <_mingw.h>

__int64

or

#include <tr1/stdint.h>

uint64_t or int64_t (sorry, no 128-bit types yet)

use cout or printf("%I64u"...) or printf("%I64d"...)

This article has been dead for over six months. Start a new discussion instead.

Recommended Articles

When I execute this progammatically, I get a table with row heights much larger than when I do this manually.

Note : Sel is the Word.Selection object and the Clipboard contains an Excel Table.

```
public void AddClipboard()
{
Sel.PasteExcelTable(false,false, false);
var t = Sel.Tables[Sel.Tables.Count];
t.AutoFitBehavior(Word.WdAutoFitBehavior.wdAutoFitContent);
}
```

the function that I created to find the ...