- 注册时间
- 2007-12-26
- 最后登录
- 1970-1-1
- 威望
- 星
- 金币
- 枚
- 贡献
- 分
- 经验
- 点
- 鲜花
- 朵
- 魅力
- 点
- 上传
- 次
- 下载
- 次
- 积分
- 92615
- 在线时间
- 小时
|
发表于 2008-4-23 21:33:10
|
显示全部楼层
写了下代码:- // HugeCalcDemo.cpp : Defines the entry point for the console application.
- //
-
- // Project -> Setting -> C/C++ -> Code Generation --> Use run-time library:
- // Win32 Debug: Debug Multithreaded DLL
- // Win32 Release: Multithreaded DLL
-
- #include <iostream.h>
-
- #include "../../../HugeCalc_API/CppAPI/Include/HugeCalc.h" // 公共接口
- #include "../../../HugeCalc_API/CppAPI/Include/HugeInt.h" // 10进制系统
- #include "../../../HugeCalc_API/CppAPI/Include/HugeIntX.h" // 16进制系统
-
- #pragma message( "automatic link to ../../../HugeCalc_API/CppAPI/Lib/HugeCalc.lib" )
- #pragma comment( lib, "../../../HugeCalc_API/CppAPI/Lib/HugeCalc.lib" )
-
-
- int main(int argc, char* argv[])
- {
- // printf("Hello World!\n");
-
- cout << "Call " << HugeCalc::GetVer() << endl << endl;
-
- if ( HC_LICENSE_NONE == HugeCalc::GetLicenseLevel())
- {
- cout << endl << "警告:您未通过 HugeCalc.dll 的许可认证!" \
- << endl << endl << "解决方案可选下列方案之一:" \
- << endl << " 一、请将本程序移动到“/CopyrightByGuoXianqiang/[../]”目录下运行;" \
- << endl << " 二、或请在 HugeCalc.chm 中进行注册(一劳永逸)。" \
- << endl << endl;
- system( "pause" );
- return (-1);
- }
-
- CHugeInt hugeNum;
-
- UINT32 i, j, k = 1;
- UINT32 u32LBound, u32UBound;
- UINT32 u32BufferSize;
- UINT32 *p, *lpPrimeBuffer;
-
- // 初始化
- HugeCalc::EnableTimer( TRUE );
- HugeCalc::ResetTimer();
-
- u32LBound = 1;
- u32UBound = 10;
- for ( i = 1; i < 8; ++i )
- {
- u32BufferSize = HugeCalc::GetPrimeCount( u32LBound, u32UBound );
- lpPrimeBuffer = new UINT32[ u32BufferSize ];
-
- HugeCalc::GetPrimeList( lpPrimeBuffer, u32BufferSize, u32LBound, u32UBound );
- for ( j=0, p=lpPrimeBuffer; j<u32BufferSize; ++j, ++p )
- {
- hugeNum.DecLShift( i ) += *p;
-
- if ( hugeNum.IsPrime() )
- {
- cout << endl << "No." << k + j << "\tPrime=" << *p
- << "\tTotal Digits = " << hugeNum.GetDigits();
- }
- }
-
- k += u32BufferSize;
- delete []lpPrimeBuffer;
-
- cout << endl << "已耗时:" << HugeCalc::GetTimerStr( FT_DOT06SEC_s ) << endl << endl;
-
- u32LBound = u32UBound;
- u32UBound *= 10;
- }
-
- system( "pause" );
-
- return 0;
- }
复制代码 |
|