On branch main
Changes to be committed: new file: Graph.cpp 1) Moved the actual declarations of functions from Graph.h into this file 2) Added get_p_edges() which will get all the edges from a specified point p 3) Added add_edge() which adds an edge between two points (start and end) modified: graph.h 1) Created initial function, constructor, and deconstructor declarations 2) Defined Point structure 3) Defined Edge structure modified: main.cpp 1) Removed any old code from my last project. I am starting clean on this file.
This commit is contained in:
54
main.cpp
54
main.cpp
@@ -1,60 +1,10 @@
|
||||
// Linked List Cycle.cpp :
|
||||
|
||||
#include "d_linked_list.h"
|
||||
#include "Graph.h"
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
d_linked_list list = d_linked_list();
|
||||
string input;
|
||||
while (true) {
|
||||
cout
|
||||
<<"Instructions: " << endl
|
||||
<< "pop" << endl
|
||||
<< "push" << endl
|
||||
<< "delete" << endl
|
||||
<< "insert" << endl
|
||||
<< "generate" << endl
|
||||
<< "sort" << endl
|
||||
<< "print" << endl
|
||||
<< "erase" << endl
|
||||
<< "quit" << endl
|
||||
<< ": ";
|
||||
cin >> input;
|
||||
cout << endl;
|
||||
|
||||
if (input == "pop") {
|
||||
list.pop();
|
||||
}
|
||||
else if (input == "push") {
|
||||
cout << "Input: ";
|
||||
int target;
|
||||
cin >> target;
|
||||
list.push(target);
|
||||
}
|
||||
else if (input == "delete") {
|
||||
int target;
|
||||
cout << "Enter element: ";
|
||||
cin >> target;
|
||||
list.del_element(target);
|
||||
}
|
||||
else if (input == "quit") {
|
||||
return 0;
|
||||
}
|
||||
else if (input == "print") {
|
||||
list.print_data();
|
||||
|
||||
}
|
||||
else if (input == "erase") {
|
||||
list.del_all_data();
|
||||
input = "";
|
||||
}
|
||||
else if (input == "generate") {
|
||||
int num_items;
|
||||
cout << "Enter number of items: ";
|
||||
cin >> num_items;
|
||||
list.gen_list(num_items);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user