当前位置: 编程技术>c/c++/嵌入式
c++大数阶乘的实现方法
来源: 互联网 发布时间:2014-10-13
本文导语: C++代码如下: #include #include #include using namespace std;typedef unsigned int Type;enum{ BASE_DATA = 10000, MAX_NUM = 100000 , MAX_SIZE = MAX_NUM+1000};struct MulOpt {Type data1;MulOpt(Type x):data1(x){}inline Type operator()(Type y){return data1*y;}};struct ConverData{inline Type op...
C++代码如下:
#include
#include
#include
using namespace std;
typedef unsigned int Type;
enum{ BASE_DATA = 10000, MAX_NUM = 100000 , MAX_SIZE = MAX_NUM+1000};
struct MulOpt {
Type data1;
MulOpt(Type x):data1(x){}
inline Type operator()(Type y)
{
return data1*y;
}
};
struct ConverData
{
inline Type operator()(Type x)
{
int y = (x/1000);
x %= 1000;
y += ( x/ 100)