#include
#include
using namespace std;
class A
{
friend ostream& operator<<(ostream& os,A& c){
cout << c.data<<" ";
return os;
}
friend bool operator==(A& a1, A& a2)
{
return a1.data == a2.data;
}
public:
A(int d=0)
{
data = d;
}
public:
void SetData(int d);
private:
int data;
};
void A::SetData(int d)
{
data = d;
}
template<class T,int MaxSet=3>
class TSet
{
public:
TSet()
{
pc = 0;
}
bool IsFull()
{
return pc >= MaxSet;
}
bool Exist(T d)
{
for (int i = 0;i < pc;i++)
{
if (ar[i] == d)
return true;
}
return false;
}
void Add(T d)
{
if (IsFull() || Exist(d))
return;
ar[pc] = d;
pc++