谁能帮我写一个整数类,能存很大的数,不会溢出(除非内存爆了)给个模板:
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) {
//文件输入
}
//类型转换帮我写写,还有构造函数,漏了什么运算也帮我写写
};