-
Notifications
You must be signed in to change notification settings - Fork 0
/
category.h
70 lines (58 loc) · 1.67 KB
/
category.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
Cosimo Gonnelli
This is the header where the LLL of questions is mamaged.
Questions are organized according to their category name.
*/
#include"question.h"
#include<iostream>
#include<fstream>
#include<cstring>
#include<cctype>
using namespace std;
//LLL class node
class l_node
{
public:
l_node();
~l_node();
l_node(const question & toCopy);
l_node(const mChoice & toCopy);
l_node(const trueFalse & toCopy);
question *& getQuestion();
l_node *& goNext();
void setNext(l_node *& connect);
void display() const;
protected:
l_node * next;
question * myQuestion; //node has a pointer of type question
};
//category class
class category
{
public:
category();
category(const category & toCopy);
category(char * name);
~category();
int compare(const category & toCompare) const;
char * getName();
int display() const;
int insertQ(mChoice *& newQuestion);
int insertTF(trueFalse *& newQuestion);
int retrieveQ(int random, question *& found);
//operator overloading
category & operator = (const category & source);
bool operator < (const category & toCompare);
bool operator <= (const category & toCompare);
bool operator > (const category & toCompare);
bool operator >= (const category & toCompare);
protected:
int destroyLLL(l_node *& head); //delete the LLL
int insertQ(l_node *& head, mChoice *& newQuestion);
int insertTF(l_node *& head, trueFalse *& newQuestion);
int retrieveQ(l_node *& head, int random, question *& found);
int display(l_node * head) const;
int countQuestion(l_node * head) const;
char * name; //category of questions used to sort the BST
l_node * head; //head of LLL of same questions
};