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

📄 integer.h

📁 分数类
💻 H
字号:
#ifndef INTEGER
#define INTEGER

#include <iostream.h>
#include "fraction.h"
#include "except.h"

class Integer : public Fraction 
{
public:
	Integer(int n=0):Fraction(n){}                  // 构造函数

	Integer(Fraction f):Fraction(f.getNumer()/f.getDemo()){}  //构造函数

	virtual int digit_number();	
	
	Integer operator-();   //重载单目“—”运算符
	
	//重载流插入流提取运算符

	friend istream & operator>>(istream& input,Integer& i);
	friend ostream & operator<<(ostream& output,Integer& i);
	
	//重载"+" "-" "*" "/" ">" ">=" "<" "<=" "==" "!=" 运算符
	friend const Integer operator+(const Integer &f1,const Integer &f2);
	friend const Integer operator-(const Integer &f1,const Integer &f2);
	friend const Integer operator*(const Integer &f1,const Integer &f2);
	friend const Integer operator/(const Integer &f1,const Integer &f2);
	friend const int operator>(const Integer &f1,const Integer &f2);
	friend const int operator>=(const Integer &f1,const Integer &f2);
	friend const int operator<(const Integer &f1,const Integer &f2);
	friend const int operator<=(const Integer &f1,const Integer &f2);
	friend const int operator==(const Integer &f1,const Integer &f2);
	friend const int operator!=(const Integer &f1,const Integer &f2);
	
	virtual ~ Integer() {}	//析构函数
};

#endif

⌨️ 快捷键说明

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