suinteger.cpp

来自「This a code about the practice of super 」· C++ 代码 · 共 55 行

CPP
55
字号
// SuInteger.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "iostream.h"

#include "SuIntegerClass.h"


int main(int argc, char* argv[])
{
	int count,i;
	char str1[]="21";
	char str2[]="4";


	SuInteger SuIntegerA,SuIntegerB,SuIntegerC;

	cout<<"Super ineger."<<endl<<endl;

	for (i=0; i<sizeof(str1)-1; i++) SuIntegerA.insert_head(str1[i]-'0');
	cout<<"Super Ineger A:";
	SuIntegerA.print();
	
	for (i=0; i<sizeof(str2)-1; i++) SuIntegerB.insert_head(str2[i]-'0');
	cout<<"Super Ineger B:";
	SuIntegerB.print();


	SuIntegerC=SuIntegerA.add(SuIntegerB,count);
	cout<<endl<<"C=A+B:";
	SuIntegerC.print();
	cout<<"Cost:"<<count<<endl<<endl;


	SuIntegerC=SuIntegerA.sub(SuIntegerB,count);
	cout<<"C=A-B:";
	SuIntegerC.print();
	cout<<"Cost:"<<count<<endl<<endl;


	SuIntegerC=SuIntegerA.mul(SuIntegerB,count);
	cout<<"C=A*B:";
	SuIntegerC.print();
	cout<<"Cost:"<<count<<endl<<endl;


	SuIntegerC=SuIntegerA.exp(SuIntegerB,count);
	cout<<"C=A^B:";
	SuIntegerC.print();
	cout<<"Cost:"<<count<<endl<<endl;

	return 0;
}

⌨️ 快捷键说明

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