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

📄 inttype.h

📁 高精度加法和减法 我自己写的 主要是实现了IntType类
💻 H
字号:
/* 
 * File:   IntType.h
 * Author: Nova
 *
 * Created on 2008��11��4��, ����3:53
 */

#ifndef _INTTYPE_H
#define	_INTTYPE_H

#include<string>
#include<ostream>
#include<cstdlib>
#include<vector>
#include<iostream>
#include<stdlib.h>
using namespace std;
class IntType
{
public:
    //构造函数
    IntType(const string & s);
    IntType(int);
    IntType(const IntType & rhs);
    IntType();
    //析构函数
    ~IntType(){}
    //调整
    void fix();
    //重载赋值运算符
    const IntType & operator= (const IntType & rhs);
    const IntType & operator+=(const IntType & rhs);
    const IntType & operator-=(const IntType & rhs);
    /*const IntType & operator*=(const IntType & rhs);
    const IntType & operator/=(const IntType & rhs);*/
    //重载算术运算符
    IntType operator+(const IntType & rhs)const;
    IntType operator-(const IntType & rhs)const;
    /*IntType operator*(const IntType & rhs)const;
    IntType operator/(const IntType & rhs)const;*/
    //重载逻辑运算符
    bool operator< (const IntType & rhs)const;
    bool operator<=(const IntType & rhs)const;
    bool operator> (const IntType & rhs)const;
    bool operator>=(const IntType & rhs)const;
    bool operator==(const IntType & rhs)const;
    bool operator!=(const IntType & rhs)const;
    bool operator!( ) const;
    IntType operator+( ) const;
    IntType operator-( ) const;
    //输出函数
    void print(ostream & out)const;
    void input(istream & in);
private:
    void init(const string & s);
    vector<int> storeArray;
    bool signalZ;//符号
};

ostream & operator<<(ostream & out,const IntType &x);
istream & operator>>(istream & in, IntType &x);
#endif	/* _INTTYPE_H */

⌨️ 快捷键说明

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