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

📄 intentry.h

📁 此程序为求两个数的约数,将他们输出,将这两个数的最大公约数输出
💻 H
字号:
#ifndef INTENTRY_CLASS
#define INTENTRY_CLASS
#include <iostream>
using namespace std;
class intEntry
{
public:	
	intEntry(int v, int c): value(v), count(c)
	{}//initialize the integer value and its count
	int getValue() const
	{
		return value;
	}
	//return value
	int getCount() const
	{
        return count;
	}
	//return count
	void increment()
	{
        count++;
	}
	//invrement count
	friend bool operator<(const intEntry& lhs,const intEntry& rhs)
	{
		if(lhs.count<rhs.count&&lhs.value==rhs.value) return true;
			else return false;
	}
    friend bool operator==(const intEntry& lhs,const intEntry& rhs)
	{
		if(lhs.value==rhs.value) return true;
			else return false;
	}
	//compare lhs and rhs using value
	friend ostream& operator<<(ostream& ostr,const intEntry& obj)
   	{
		ostr <<"Value = "<<obj.value<<" Count= "<<obj.count<<" ; ";
		return ostr;
	}
	//output obj in format"value value ...value"(count times)
private:
	int value;
	int count;
};
#endif

⌨️ 快捷键说明

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