73 lines
1.4 KiB
C
73 lines
1.4 KiB
C
|
#include <iostream>
|
||
|
#include <string>
|
||
|
#define Node node *
|
||
|
|
||
|
typedef struct node
|
||
|
{
|
||
|
int data;
|
||
|
Node pred;
|
||
|
Node succ;
|
||
|
} node;
|
||
|
|
||
|
class List
|
||
|
{
|
||
|
private:
|
||
|
Node header = new node;
|
||
|
Node trailer = new node;
|
||
|
int _size;
|
||
|
|
||
|
protected:
|
||
|
int clear();
|
||
|
|
||
|
public:
|
||
|
List();
|
||
|
Node first() { return header->succ; }
|
||
|
Node last() { return trailer->pred; }
|
||
|
void firstInsert(int New);
|
||
|
void lastInsert(int New);
|
||
|
Node succInsert(Node Old, int New);
|
||
|
Node predInsert(Node Old, int New);
|
||
|
Node firstInsertN(Node New);
|
||
|
Node lastInsertN(Node New);
|
||
|
Node succInsertN(Node old, Node ne);
|
||
|
Node predInsertN(Node old, Node ne);
|
||
|
int get(int i);
|
||
|
Node find(int i);
|
||
|
|
||
|
int operator[](int i)
|
||
|
{
|
||
|
Node p = first();
|
||
|
while (0 < i--)
|
||
|
p = p->succ;
|
||
|
return p->data;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
class PUKE
|
||
|
{
|
||
|
private:
|
||
|
std::string PU[54] = {
|
||
|
"1A", "1B", "1C", "1D",
|
||
|
"2A", "2B", "2C", "2D",
|
||
|
"3A", "3B", "3C", "3D",
|
||
|
"4A", "4B", "4C", "4D",
|
||
|
"5A", "5B", "5C", "5D",
|
||
|
"6A", "6B", "6C", "6D",
|
||
|
"7A", "7B", "7C", "7D",
|
||
|
"8A", "8B", "8C", "8D",
|
||
|
"9A", "9B", "9C", "9D",
|
||
|
"10A", "10B", "10C", "10D",
|
||
|
"JA", "JB", "JC", "JD",
|
||
|
"QA", "QB", "QC", "QD",
|
||
|
"KA", "KB"
|
||
|
"KC",
|
||
|
"KD",
|
||
|
"BlackJoker", "RadJoker"};
|
||
|
|
||
|
public:
|
||
|
std::string p(int a)
|
||
|
{
|
||
|
return PU[a];
|
||
|
}
|
||
|
};
|