⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.cpp

📁 dot NET 下的大整数乘法
💻 CPP
字号:
// BigInteger.cpp: 主项目文件。

#include "stdafx.h"
#include "BigInteger.h"

using namespace System;

int main(array<System::String ^> ^args)
{
	DateTime time;
	Int64 tt;
	int i;
    BigInteger^ b1=gcnew BigInteger();
	b1->InitFromString("123456789123456789123456789123456789123456789123456789123456789");
	BigInteger^ b2=gcnew BigInteger();
	b2->InitFromString("123456789123456789123456789123456789123456789123456789123456789");
	time=DateTime::Now;
	tt=time.Ticks;
	for (i=0; i<9; i++)
	{
		b1=b1*b1;
	}
	time=DateTime::Now;
	tt=time.Ticks-tt;
	Console::WriteLine("快速算法结果:");
	String^ s=b1->ToString();
	//Console::WriteLine(b1->ToString());
	System::Text::ASCIIEncoding^ uniEncoding=gcnew System::Text::ASCIIEncoding();
	System::IO::FileStream^ t=gcnew System::IO::FileStream("result.txt", System::IO::FileMode::Create);
	t->Write(uniEncoding->GetBytes(s), 0, uniEncoding->GetByteCount(s) );
	t->Close();
	//t->Create("result.txt");
	//Console::WriteLine("快速算法花费时间:"+tt.ToString());
	/*time=DateTime::Now;
	tt=time.Ticks;
	b2=b2->CommomMutiple(b2);
	time=DateTime::Now;
	tt=time.Ticks-tt;
	Console::WriteLine("普通算法结果:");
	Console::WriteLine(b2->ToString());*/
	//Console::WriteLine("普通算法花费时间:"+tt.ToString());
    return 0;
}

⌨️ 快捷键说明

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