#pragma once
#include <stdio.h>
#include <string.h>
class Link {
friend class List;
Link* next;
char item[20];
public:
Link(const char* x = "") {
strcpy_s(item, x);
next = NULL;
}
Link* Next(void) { return (next); }
void LinkPrint(void) { printf("%s\n", item); }
};
class List {
protected:
Link* first;
Link* last;
public:
List(void) { first = last = new Link; }
~List() { Clear(); delete first; }
List& Insert(const Link&);
List& Append(const Link&);
List& Delete(void);
List& Remove(void);
List& Clear(void);
void Print(void);
};
カテゴリー