update filenames

This commit is contained in:
2021-01-08 17:17:32 +01:00
parent 2f9f32e50e
commit 6485a3b3d6
6 changed files with 33 additions and 34 deletions

View File

@@ -0,0 +1,5 @@
class Stack {
void push(int element, bool output);
void pop(int element, bool output);
void size(int element, bool output);
};

View File

@@ -1 +1 @@
add_library(sets STATIC Node.h Node.cpp Set.h Set.cpp ) add_library(sets STATIC Node.h Node.cpp Stack.h Stack.cpp ADT_Stack.cpp )

View File

@@ -1,16 +0,0 @@
#pragma once
#include "Node.h"
class Set {
protected:
std::string name;
Set(std::string _name);
Node* first;
public:
bool add(int element);
bool rmv(int element);
bool ctn(int element);
std::string get_name();
std::string print_set();
};

View File

@@ -1,21 +1,19 @@
#include "Set.h" #include "Stack.h"
#include "Node.h" #include "Node.h"
#include <iostream> #include <iostream>
#include<sstream> #include<sstream>
Set::Set(std::string _name){ Stack::Stack(std::string _name){
name = _name;
first = Node::Dummy(); first = Node::Dummy();
first->next = Node::Dummy(); first->next = Node::Dummy();
} }
bool Set::add(int element) { return false; } bool Stack::push(int element) { return false; }
bool Set::rmv(int element) { return false; } bool Stack::pop(int element) { return false; }
bool Set::ctn(int element) { return false; } bool Stack::size(int element) { return false; }
std::string Set::get_name() { return name; }
std::string Set::print_set(){ std::string Stack::print_stack(){
Node* c = this->first->next; Node* c = this->first->next;
std::stringstream ss; std::stringstream ss;
while (!c->is_dummy()) { while (!c->is_dummy()) {

15
Assignment_3/lib/Stack.h Normal file
View File

@@ -0,0 +1,15 @@
#pragma once
#include "Node.h"
class Stack {
protected:
std::string name;
Stack(std::string _name);
Node* first;
public:
bool push(int element);
bool pop(int element);
bool size(int element);
std::string print_stack();
};

View File

@@ -2,7 +2,7 @@
#include <iostream> #include <iostream>
#include <stdlib.h> #include <stdlib.h>
#include <lib/Set.cpp> #include <lib/Stack.cpp>
using namespace std::chrono; using namespace std::chrono;
@@ -16,22 +16,19 @@ using namespace std::chrono;
#define OP_COUNT 100000 #define OP_COUNT 100000
enum methodname {add, rmv, ctn, noop}; enum methodname {push, pop, size, noop};
typedef struct _operation{ typedef struct _operation{
methodname method; methodname method;
int input; int input;
} operation; } operation;
void do_operation(operation* op, Set* set) { void do_operation(operation* op, Stack* set) {
switch (op->method) { switch (op->method) {
case methodname::ctn: case methodname::push:
set->ctn(op->input);
break; break;
case methodname::add: case methodname::pop:
set->add(op->input);
break; break;
case methodname::rmv: case methodname::size:
set->rmv(op->input);
break; break;
default: default:
break; break;