stonewt.h

来自「我学习C++ Primer Plus过程中写下的课后作业的编程代码」· C头文件 代码 · 共 27 行

H
27
字号
// 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;
	// friends
	friend std::ostream & operator<< ( std::ostream & os, const Stonewt & s );
};
#endif

⌨️ 快捷键说明

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