www.gusucode.com > VC++数论计算的无符号大整数类及范例源码程序 > VC++数论计算的无符号大整数类及范例源码程序/code/BigNum.cpp

    // $$root$$.cpp : Defines the entry point for the application.
//

#include "stdafx.h"
#include "USuperInt.h"
//Download by http://www.NewXing.com
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
	try
	{	
		
		//下面的代码计算Fibonacci级数的前200个。
		CStdioFile f;
		f.Open("D:\\USuperInt.Txt",CFile::modeCreate|CFile::modeWrite|CFile::typeText);
		CUSuperInt a = 1;
		CUSuperInt b = 1;
		for (int i=0; i<99; i++)
		{
		
			a += b;
			f.WriteString(a.ToDecStr());
			f.WriteString("\n");
			b += a;
			f.WriteString(b.ToDecStr());
			f.WriteString("\n");
		}

		f.Close();
		AfxMessageBox("计算完成");
	}
	catch (CMyException* e)
	{
		AfxMessageBox(e->m_szMsg);		
	}
	catch(...)
	{
		AfxMessageBox("未知错误");
	}
	return 0;	
	
}