求助
  • 板块灌水区
  • 楼主yanhaoming
  • 当前回复8
  • 已保存回复8
  • 发布时间2024/8/1 14:17
  • 上次更新2024/8/1 15:28:12
查看原帖
求助
1332467
yanhaoming楼主2024/8/1 14:17

谁能帮我写一个整数类,能存很大的数,不会溢出(除非内存爆了)给个模板:


class lllong {
	private:
		vector<bool> vc;//二进制存储
	public:
		lllong& operator=(long long &a) {
			//赋值
		}
		bool operator>(lllong a2) {
			//比较
		}
		bool operator<(lllong a2) {
			//比较
		}
		lllong operator+(lllong a2) {
			//计算
		}
		lllong operator-(lllong a2) {
			//计算
		}
		lllong operator*(lllong a2) {
			//计算
		}
		lllong operator/(lllong a2) {
			//计算
			//除零直接exit(1)
		}
		lllong operator<<(lllong a2) {
			//位移
		}
		lllong operator>>(lllong a2) {
			//位移
		}
		ostream& friend operator<<(ostream& out, lllong a2) {
			//cout输出
		}
		ofstream& friend operator<<(ofstream& out, lllong a2) {
			//文件输出
		}
		istream& friend operator>>(istream& out, lllong a2) {
			//cin输入 
		}
		ifstream& friend operator<<(ifstream& out, lllong a2) {
			//文件输入 
		}
		//类型转换帮我写写,还有构造函数,漏了什么运算也帮我写写 
};
2024/8/1 14:17
加载中...