-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
94 lines (71 loc) · 1.97 KB
/
main.cpp
File metadata and controls
94 lines (71 loc) · 1.97 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
#include<iostream>
#include"reclists.hpp"
#include"solutions.hpp"
// Get a list from the user for a specific purpose,
// and output that list
list get_list(std::string purpose) {
std::cout << "Enter a list for " << purpose << ": ";
list p = read_list();
std::cout << "Echoing the list that you entered below." << std::endl;
write_list(p);
return p;
}
void testNumNodesAtTheTopLevel() {
// Test this numNodesAtTheTopLevel 3 times.
auto p = get_list("testing numNodesAtTheTopLevel");
std::cout << "The number of nodes at the top-level is " << numNodesAtTheTopLevel(p) << std::endl;
}
void testNumAtomsAtTheTopLevel() {
// Test this numAtomssAtTheTopLevel
auto p = get_list("testing numAtomssAtTheTopLevel");
std::cout << "The number of nodes at the top-level is " << numAtomsAtTheTopLevel(p) << std::endl;
}
void testAreEqual() {
auto p = get_list("List p: ");
auto q = get_list("List q: ");
if (areEqual(p, q)) {
std::cout << "Are equal" << std::endl;
}
else {
std::cout << "Are not equal" << std::endl;
}
}
void testFind() {
auto p = get_list("List p: ");
auto q = get_list("List q: ");
if (find(p, q)) {
std::cout << "Found" << std::endl;
}
else {
std::cout << "Not Found" << std::endl;
}
}
void evenTest() {
auto p = get_list("List p: ");
if (evenNumberOfAtoms(p)) {
std::cout << "Even number of atoms" << std::endl;
}
else {
std::cout << "Not even number of atoms" << std::endl;
}
}
void everyOtherTest() {
auto p = get_list("List p: ");
auto q = get_list("List q: ");
if (everyOtherAtom(p, q)) {
std::cout << "Every other atom" << std::endl;
}
else {
std::cout << "Not every other atom" << std::endl;
}
}
int main()
{
// testNumNodesAtTheTopLevel();
// testNumAtomsAtTheTopLevel();
// testFind();
//testAreEqual();
//evenTest();
everyOtherTest();
return 0;
}