integerset.h
来自「给出集合类的定义」· C头文件 代码 · 共 38 行
H
38 行
// 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 + =
减小字号Ctrl + -
显示快捷键?