-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprint.cpp
More file actions
50 lines (44 loc) · 1.76 KB
/
print.cpp
File metadata and controls
50 lines (44 loc) · 1.76 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
#include <iostream>
#include <string>
#include "datastructures.h"
using namespace std;
// separate print functions to print out the data given
// I thought the data was supposed to be kept in a struct but I don't know if I'll have time tonight
// So I'll pull from the classes
/*
// Queue
void print(Queue<*void> q) { //take in the Queue that is given. *void since I'm pretty sure the data can be anything but subject to change
cout << "====== Start Of Data ======" << endl; // Makes it more readable
while(!q.empty()) {
cout << q.front() << endl;
q.pop();
}
cout << "====== End Of Data ======" << endl; // Makes it more readable
}
// Linked List
void print(LinkedList<*void> l) { // This has it's own print function...? Again, *void can be replaced
cout << "====== Start Of Data ======" << endl; // Makes it more readable
l.print(); // I don't know what this print looks like...
// This is here in case the print function stated above needs to be redone/reformatted
for(int i = 0; i < l.length(); i++) {
cout << l.nth(i); // I'm assuming nth function accesses a specific section of the linkedlist?
}
/
cout << "====== End Of Data ======" << endl; // Makes it more readable
}
// Dynamic Array
// Wait a second this defines the functions in the class???
void print(DynamicArray<*void> d) { // same deal as above, *void can be replaced
cout << "====== Start Of Data ======" << endl;
for(int i = 0; i < d.size(); i++) {
cout << d[i] << endl; // I'm actually not 100% on how to access the data for this class
}
cout << "====== End Of Data ======" << endl;
}
*/
// since the data structures changed, this isn't how it's being done now
void print(DataStructures d) {
cout << "====== Start Of Data ======" << endl;
d.display();
cout << "====== End Of Data ======" << endl;
}