From 7e276db9c382bb667faabee06ca034ad99534d4d Mon Sep 17 00:00:00 2001 From: Eduardo Machado <emm14@inf.ufpr.br> Date: Wed, 30 Sep 2015 12:27:03 -0300 Subject: [PATCH] criado o makefile --- Makefile | 17 +++++++++++++++++ include/bst_lib.h | 19 +++++++++++++++++++ src/bst_lib.cpp | 4 ++-- src/main.cpp | 2 +- 4 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 Makefile create mode 100644 include/bst_lib.h diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6a17adb --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ +CC=g++ +LIB=./lib +INCLUDE=./include +SRC=./src +OBJ=./obj +LIBFLAGS = -lbst_lib +FLAGS = -Wall + +main: bst_lib + $(CC) $(SRC)/main.cpp $(FLAGS) -I$(INCLUDE) -L$(LIB) $(LIBFLAGS) -o bst + +bst_lib: + $(CC) -c $(SRC)/bst_lib.cpp $(FLAGS) -I$(INCLUDE) -o $(OBJ)/bst_lib.o + ar -cru $(LIB)/bst_lib.a $(OBJ)/bst_lib.o + +clean: + rm bst $(SRC)/*~ $(OBJ)/*o $(LIB)/*a diff --git a/include/bst_lib.h b/include/bst_lib.h new file mode 100644 index 0000000..2aeccba --- /dev/null +++ b/include/bst_lib.h @@ -0,0 +1,19 @@ +// Implementado por Eduardo Machado +// 2015 + +class Node{ + private: + int key; + char truck; + Node *leftNode; + Node *rightNode; + Node *fatherNode; + + public: + void setKey(int newKey); + void setTruck(char newTruck); + void setLeftNode(Node *newLeftNode); + void setRightNode(Node *newRightNode); + void setFatherNode(Node *newRatherNode); + void printInOrder(); +}; diff --git a/src/bst_lib.cpp b/src/bst_lib.cpp index 0164a33..43afaf9 100644 --- a/src/bst_lib.cpp +++ b/src/bst_lib.cpp @@ -2,7 +2,7 @@ // 2015 #include <iostream> -#include "lib/bst_lib.h" +#include "bst_lib.h" using namespace std; @@ -29,7 +29,7 @@ void Node::setFatherNode(Node *newFatherNode){ void Node::printInOrder(){ if(this->leftNode!=NULL){ - this->leftNode.printInOrder() + this->leftNode->printInOrder() } std::cout << " " << this->truck << this->key << " " << std::endl; if(this->rightNode!=NULL){ diff --git a/src/main.cpp b/src/main.cpp index eeb0ff4..83d683f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,7 +2,7 @@ // 2015 #include <iostream> -#include "lib/bst_lib.h" +#include "bst_lib.h" using namespace std; -- GitLab