您当前的位置: 首页 >  c++

惊鸿一博

暂无认证

  • 6浏览

    0关注

    535博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

C++_Operator Overloading(运算符重载 | 计算有理数的加减乘除)

惊鸿一博 发布时间:2017-03-20 23:17:25 ,浏览量:6

// OperatorT.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include 

//运算符的重载 
//计算有理数rational的 + - * /

class Rational
{
public:
	Rational();//构造函数初始化
	Rational(int numer, int denom);
	Rational operator +(Rational  d);// 
	Rational operator -(Rational  d);
	Rational operator *(Rational  d);
	Rational operator /(Rational  d);

	void print();
private:
	friend std::ostream &operator            
关注
打赏
1663399408
查看更多评论
0.0404s