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

📄 crational.h

📁 数据结构中
💻 H
字号:
// Crational.h: interface for the rational class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_CRATIONAL_H__3F1E8682_7B21_406A_A4DA_381C9052F97D__INCLUDED_)
#define AFX_CRATIONAL_H__3F1E8682_7B21_406A_A4DA_381C9052F97D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class Rational
{
public:
  Rational();   //无参构造函数
  Rational(int fenzi,int fenMu); //传分子分母构造函数
  Rational(const Rational &p);   //拷贝构造函数
  Rational  HuaJian( Rational &p);
   
 Rational operator+(const Rational &p);
 Rational operator-(const Rational &p);
 Rational operator*(const Rational &p);
 Rational operator +=(const Rational &p);
 Rational operator /=(const Rational &p);
 Rational operator/(const Rational &p);
    int operator ==(const Rational &p) ;
	int operator !=(const Rational &p) ;
    friend Rational operator *(Rational &p,int n);
    friend Rational operator *(int n,Rational &p);
           Rational operator =(int n);
   // friend Rational operator =(Rational &p,);
   void showR();
   void Setnumden(int num,int den);
   int Getnum();
   int Getden();
   
 private:
   int fenZi;
   int fenMu;
   int ZDGY(int x, int y);  //最大公约数
   int ZXGB(int x, int y);  //最小公倍数

};
#endif // !defined(AFX_CRATIONAL_H__3F1E8682_7B21_406A_A4DA_381C9052F97D__INCLUDED_)

⌨️ 快捷键说明

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