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

📄 stonewt.h

📁 我学习C++ Primer Plus过程中写下的课后作业的编程代码
💻 H
字号:
// stonewt.h -- definition for Stonewt class
#ifndef STONEWT_H_
#define STONEWT_H_
class Stonewt
{
private:
	enum   { Lbs_per_stn = 14 };		// pounds per stone
	int    stone;						// whole stones
	double pds_left;					// fractional pounds
	double pounds;						// entire weight in pounds
	char   mode;
public:
	Stonewt ( double lbs, char m = 'p' );			// constructor for double pounds
	Stonewt ( int stn, double lbs , char m = 'p' );		// constructor for stone, lbs
	Stonewt ();						// default constructor
	~Stonewt ();
	void pds_mode ();
	void stn_mode ();
	// operator overloding
	Stonewt operator + ( const Stonewt & s )const;
	Stonewt operator - ( const Stonewt & s )const;
	Stonewt operator * ( const Stonewt & s )const;
	bool operator <  ( const Stonewt & s )const;
	bool operator <= ( const Stonewt & s )const;
	bool operator >  ( const Stonewt & s )const;
	bool operator >= ( const Stonewt & s )const;
	bool operator == ( const Stonewt & s )const;
	bool operator != ( const Stonewt & s )const;
	// friends
	friend std::ostream & operator<< ( std::ostream & os, const Stonewt & s );
//	friend std::istream & operator>> ( std::istream & os, Stonewt & s );
};
#endif

⌨️ 快捷键说明

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