feat finish all preparation works

This commit is contained in:
2023-10-24 23:07:15 +08:00
parent d133f76ad1
commit 438152ffca
3 changed files with 159 additions and 162 deletions

View File

@ -2,56 +2,29 @@
#ifndef SJTU_BIGINTEGER
#define SJTU_BIGINTEGER
// Integer 1:
// 实现一个有符号的大整数类,只需支持简单的加减
// Integer 2:
// 实现一个有符号的大整数类,支持加减乘除,并重载相关运算符
// 请不要使用除了以下头文件之外的其它头文件
#include <complex>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
// 请不要使用 using namespace std;
namespace sjtu {
class int2048 {
// todo
public:
// 构造函数
int2048();
int2048(long long);
int2048(const std::string &);
int2048(const int2048 &);
// 以下给定函数的形式参数类型仅供参考,可自行选择使用常量引用或者不使用引用
// 如果需要,可以自行增加其他所需的函数
// ===================================
// Integer1
// ===================================
// 读入一个大整数
void read(const std::string &);
// 输出储存的大整数,无需换行
void print();
// 加上一个大整数
int2048 &add(const int2048 &);
// 返回两个大整数之和
friend int2048 add(int2048, const int2048 &);
// 减去一个大整数
int2048 &minus(const int2048 &);
// 返回两个大整数之差
friend int2048 minus(int2048, const int2048 &);
// ===================================
// Integer2
// ===================================
int2048 operator+() const;
int2048 operator-() const;
@ -84,4 +57,4 @@ class int2048 {
};
} // namespace sjtu
#endif
#endif