-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathknowt.cpp
More file actions
121 lines (103 loc) · 2.87 KB
/
knowt.cpp
File metadata and controls
121 lines (103 loc) · 2.87 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#include <iostream> //Being used for standard output.
#include <vector> //Used for holding the 'cards'.
#include <string> //Being used for information about the cards and general string usage.
/**
* @desc The type card used for creating a card object.
*/
class Card {
private:
std::string primaryStatement; //The front of the card.
std::string primaryResponse; //The back of the card.
public:
/* Public members */
std::string getFront(); //Returns the front of the card.
std::string getBack(); //Returns the back of the card.
/* Constructor */
Card(std::string, std::string);
/* Debugging methods */
void outputCard(); //Outputs the cards information.
};
/**
* @desc The constructor for setting properties of a card.
* @param {std::string} front the front of the card.
* @param {stdd:string} back the back of the card.
*/
Card::Card(std::string front, std::string back) {
this->primaryStatement = front;
this->primaryResponse = back;
}
/**
* @desc Getter function for returning the string of the front of the card.
* @return {std::string} returns a string of the front of the card.
*/
std::string Card::getFront() {
return this->primaryStatement; //Return the front of the card.
}
/**
* @desc Getter function for returning the string of the back of the card.
* @return {std::string} returns a string of the back of the card.
*/
std::string Card::getBack() {
return this->primaryResponse;
}
/**
* @desc Output information about the card to standard output.
*/
void Card::outputCard() {
std::cout << "Front: " << this->getFront() << std::endl;
std::cout << "Back: " << this->getBack() << std::endl;
}
/**
* @desc A grouping of individuals of type Card held into a vector.
*/
class Cards {
private:
std::vector<Card> cardGroup;
std::string title;
public:
/* Public members */
std::vector<Card> getCards();
std::string getTitle();
void addCard(Card);
/* Debugging methods */
void outputCards();
};
/**
* @desc Return the cards by reference.
* @return {std::vector<Card>} the cards being returned.
*/
std::vector<Card> Cards::getCards() {
return this->cardGroup;
}
/**
* @desc Return the title of the card group.
* @return {std::string} the title of the cards group.
*/
std::string Cards::getTitle() {
return this->title;
}
/**
* @desc Add a card to the top of the deck.
* @param {Card} card the card to be added to the deck.
*/
void Cards::addCard(Card card) {
(this->cardGroup).push_back(card); //Add the card to the top of the stack. LIFO
}
/**
* @desc Output the cards to standard out.
*/
void Cards::outputCards() {
for (auto &card : this->cardGroup) {
std::cout << card.getFront() << " - ";
}
std::cout << std::endl;
}
/**
* @desc The main function, starting the whole process with the active stuff.
*/
int main() {
Card card = Card("Front", "Back");
Cards cards;
cards.outputCards();
return 0;
}