- 注册时间
- 2007-12-26
- 最后登录
- 1970-1-1
- 威望
- 星
- 金币
- 枚
- 贡献
- 分
- 经验
- 点
- 鲜花
- 朵
- 魅力
- 点
- 上传
- 次
- 下载
- 次
- 积分
- 92658
- 在线时间
- 小时
|
发表于 2008-5-9 07:57:03
|
显示全部楼层
与楼上同龄。
我写了段代码,得到如下结果:从2000起写到2003止为素数;从2009起写到2049止为素数。
代码如下,大家可以自修改编译运行(试试以你中意数字起头的搜索):- // 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");
-
- UINT32 i = 2000;
- CHugeIntX hugeTest(i);
-
- 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);
- }
-
- HugeCalc::EnableTimer();
- HugeCalc::ResetTimer();
-
- while ( 10000 > ++i )
- {
- ( hugeTest *= 10000 ) += i;
-
- if ( hugeTest.IsPrime() )
- {
- cout << HugeCalc::GetTimerStr( FT_HHMMSS_ms ) << "\ti = " << i << "\tOK" << endl;
- }
- else if ( 0 == i & 0xFF )
- {
- cout << HugeCalc::GetTimerStr( FT_HHMMSS_ms ) << "\ti = " << i << endl;
- }
- }
-
- system( "pause" );
-
- return 0;
- }
复制代码 |
|