fraction.hpp
来自「这些程序是本人学习数据结构时编的」· HPP 代码 · 共 22 行
HPP
22 行
#include<iostream.h>
class Fraction{
public:
Fraction(int a=0,int b=1);
Fraction(const Fraction& other);
Fraction mins1(); //用辗转相除法化简
Fraction mins2(); //用分解因式化简
Fraction operator +(const Fraction& other);
Fraction operator -(const Fraction& other);
Fraction operator *(const Fraction& other);
Fraction operator /(const Fraction& other);
Fraction operator =(const Fraction& other);
int operator <(const Fraction& other);
int operator >(const Fraction& other);
int operator ==(Fraction& other);
void change(double c);
Fraction redu(const Fraction& other);
friend ostream& operator <<(ostream& stream,Fraction& obj); //重载输出符<<
friend istream& operator >>(istream& stream,Fraction& obj);//重载输入符>>
protected:
int deno,nume;
};
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?