diff --git a/d_linked_list.h b/d_linked_list.h new file mode 100644 index 0000000..2e96e93 --- /dev/null +++ b/d_linked_list.h @@ -0,0 +1,51 @@ +#pragma once +#include +#include +#include + +using namespace std; + +class d_linked_list { + + struct Point { + private: + string name; + int x; + int y; + + vector edges[5]; + + Point() : name("Unnamed"), x(0), y(0) {}; + Point(string new_name, int new_x, int new_y) : name(new_name), x(new_x), y(new_y) {}; + Point(string new_name, int new_x, int new_y, Point* edge) : name(new_name), x(new_x), y(new_y) { + edges->push_back(edge); + }; + }; + +private: + Point* start; + Point* end; + +public: + //class constructor + d_linked_list() : start(nullptr), end(nullptr) {}; + + int rand_int() {}; + void del_all_data(){}; + void del_element(int){}; + void insert(int, int, vector){}; + void gen_list(int){}; + void print_graph(){}; + + +//Setters + int rand_int() { + random_device rd; + mt19937 gen(rd()); + uniform_int_distribution dist(1, 30); + return dist(gen); + } + +//Mutators + +}; \ No newline at end of file diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..99cc6a3 --- /dev/null +++ b/main.cpp @@ -0,0 +1,60 @@ +// Linked List Cycle.cpp : + +#include "d_linked_list.h" +#include +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); + } + } +} +