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

📄 integerset.h

📁 给出集合类的定义
💻 H
字号:
// File Name: 		 prog2_2.cpp)
// Author: 			dongfei
// Email: 			dongfei@nankai.edu.cn
// Assignment: 		2_2
// Description: 	Create a class called IntegerSet

//Integer.h 类的声明
#include<iostream>
#include<fstream>

using namespace std;
const int MAX = 101;

class IntegerSet
{
	//操作符重载,友元函数
	friend ostream& operator<<(ostream& out,const IntegerSet& x);
public:
	//初始化集合
	IntegerSet();
	~IntegerSet();
	//集合的并集运算
 	void unionOf(const IntegerSet &set1, const IntegerSet &set2 );
	//集合的交集运算
    void intersectionOf( const IntegerSet &set1, const IntegerSet &set2 );
	//判断是否集合相等
	bool isEqualTo( const IntegerSet &set );
	//在其集合中插入元素
	void insertElement( int num );
	//在在集合中删除元素
	void deleteElement( int num );
	//判断元素是否在集合中
	bool isInSet( int num );
	//打印集合
	void printSet( ostream &ostr ) const;
private:
	bool element[MAX];
};

⌨️ 快捷键说明

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