bignum.cpp

来自「可以进行无限制的整数计算」· C++ 代码 · 共 44 行

CPP
44
字号
// $$root$$.cpp : Defines the entry point for the application.//#include "stdafx.h"
#include "USuperInt.h"

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;	
	
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?