aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--license21
-rw-r--r--week-1/Opteller.cpp13
-rw-r--r--week-1/Opteller.h12
-rw-r--r--week-1/main.cpp24
-rw-r--r--week-1/makefile22
-rw-r--r--week-2/Driehoek.cpp15
-rw-r--r--week-2/Driehoek.h13
-rw-r--r--week-2/Rechthoek.cpp14
-rw-r--r--week-2/Rechthoek.h13
-rw-r--r--week-2/Vorm.cpp13
-rw-r--r--week-2/Vorm.h9
-rw-r--r--week-2/main.cpp21
-rw-r--r--week-2/makefile24
14 files changed, 217 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..d82a6c2
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+**/*.o
+**/*.pdf
+**/main
diff --git a/license b/license
new file mode 100644
index 0000000..46973e2
--- /dev/null
+++ b/license
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2022 lonkaars
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/week-1/Opteller.cpp b/week-1/Opteller.cpp
new file mode 100644
index 0000000..41efee0
--- /dev/null
+++ b/week-1/Opteller.cpp
@@ -0,0 +1,13 @@
+#include "Opteller.h"
+
+void Opteller::initialiseer() {
+ som = 0;
+}
+
+void Opteller::voegWaardeToe(int waarde) {
+ som += waarde;
+}
+
+int Opteller::geefSom() {
+ return som;
+}
diff --git a/week-1/Opteller.h b/week-1/Opteller.h
new file mode 100644
index 0000000..2f21d79
--- /dev/null
+++ b/week-1/Opteller.h
@@ -0,0 +1,12 @@
+#pragma once
+
+class Opteller {
+ private:
+ int som;
+
+ public:
+ void initialiseer();
+ void voegWaardeToe(int waarde);
+ int geefSom();
+};
+
diff --git a/week-1/main.cpp b/week-1/main.cpp
new file mode 100644
index 0000000..0d895f4
--- /dev/null
+++ b/week-1/main.cpp
@@ -0,0 +1,24 @@
+/*
+ * Do not adapt this file!!!
+ */
+
+
+#include "Opteller.h"
+#include <iostream>
+
+int main()
+{
+ Opteller opteller;
+
+ opteller.initialiseer(); // zet som op 0
+ opteller.voegWaardeToe( 1 ); // tel 1 erbij
+ opteller.voegWaardeToe( 2 ); // tel 2 erbij
+ opteller.voegWaardeToe( 3 ); // tel 3 erbij
+ opteller.voegWaardeToe( 4 ); // tel 4 erbij
+ opteller.voegWaardeToe( 5 ); // tel 5 erbij
+
+ std::cout << opteller.geefSom() << std::endl; // toon de som
+ std::cin.get(); // wacht op <enter>
+
+ return 0;
+} \ No newline at end of file
diff --git a/week-1/makefile b/week-1/makefile
new file mode 100644
index 0000000..8ab5b1c
--- /dev/null
+++ b/week-1/makefile
@@ -0,0 +1,22 @@
+CC = g++
+LD = g++
+RM = rm -f
+CFLAGS =
+EXECNAME = main
+
+SOURCES := $(wildcard *.cpp)
+OBJECTS := $(patsubst %.cpp,%.o, $(SOURCES))
+
+all: main
+
+.o:
+ $(CC) -c $(CFLAGS) $<
+
+$(EXECNAME): $(OBJECTS)
+ $(CC) $(OBJECTS) -o $(EXECNAME)
+
+clean:
+ $(RM) $(EXECNAME)
+
+distclean: clean
+ $(RM) *.o
diff --git a/week-2/Driehoek.cpp b/week-2/Driehoek.cpp
new file mode 100644
index 0000000..1c1323c
--- /dev/null
+++ b/week-2/Driehoek.cpp
@@ -0,0 +1,15 @@
+#include "Driehoek.h"
+
+Driehoek::Driehoek(double b, double h) {
+ breedte = b;
+ hoogte = h;
+}
+
+double Driehoek::getSomGraden() {
+ return 180;
+}
+
+double Driehoek::getOppervlakte() {
+ return breedte * hoogte * 0.5f;
+}
+
diff --git a/week-2/Driehoek.h b/week-2/Driehoek.h
new file mode 100644
index 0000000..f8a3a37
--- /dev/null
+++ b/week-2/Driehoek.h
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "Vorm.h"
+
+class Driehoek : public Vorm {
+ public:
+ Driehoek(double breedte, double hoogte);
+ virtual double getOppervlakte();
+ virtual double getSomGraden();
+ private:
+ double breedte;
+ double hoogte;
+};
diff --git a/week-2/Rechthoek.cpp b/week-2/Rechthoek.cpp
new file mode 100644
index 0000000..1f7b313
--- /dev/null
+++ b/week-2/Rechthoek.cpp
@@ -0,0 +1,14 @@
+#include "Rechthoek.h"
+
+Rechthoek::Rechthoek(double b, double h) {
+ breedte = b;
+ hoogte = h;
+}
+
+double Rechthoek::getSomGraden() {
+ return 360;
+}
+
+double Rechthoek::getOppervlakte() {
+ return breedte * hoogte;
+}
diff --git a/week-2/Rechthoek.h b/week-2/Rechthoek.h
new file mode 100644
index 0000000..4f526f9
--- /dev/null
+++ b/week-2/Rechthoek.h
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "Vorm.h"
+
+class Rechthoek : public Vorm {
+ public:
+ Rechthoek(double breedte, double hoogte);
+ virtual double getSomGraden();
+ virtual double getOppervlakte();
+ private:
+ double breedte;
+ double hoogte;
+};
diff --git a/week-2/Vorm.cpp b/week-2/Vorm.cpp
new file mode 100644
index 0000000..c919d08
--- /dev/null
+++ b/week-2/Vorm.cpp
@@ -0,0 +1,13 @@
+#include "Vorm.h"
+
+Vorm::Vorm() {
+ return;
+}
+
+double Vorm::getOppervlakte() {
+ return 0;
+}
+
+double Vorm::getSomGraden() {
+ return 0;
+}
diff --git a/week-2/Vorm.h b/week-2/Vorm.h
new file mode 100644
index 0000000..17cf486
--- /dev/null
+++ b/week-2/Vorm.h
@@ -0,0 +1,9 @@
+#pragma once
+
+class Vorm {
+ public:
+ Vorm();
+ virtual double getOppervlakte();
+ virtual double getSomGraden();
+};
+
diff --git a/week-2/main.cpp b/week-2/main.cpp
new file mode 100644
index 0000000..69db85b
--- /dev/null
+++ b/week-2/main.cpp
@@ -0,0 +1,21 @@
+/*
+ * Do not adapt this file!!!
+ */
+#include "Driehoek.h"
+#include "Rechthoek.h"
+
+#include <iostream>
+
+int main()
+{
+ Vorm *driehoek = new Driehoek( 6.0, 8.0 );
+ Vorm *rechthoek = new Rechthoek( 6.0, 8.0 );
+
+ std::cout << driehoek ->getOppervlakte() << " " << driehoek ->getSomGraden() << std::endl;
+ std::cout << rechthoek->getOppervlakte() << " " << rechthoek->getSomGraden() << std::endl;
+
+ delete driehoek;
+ delete rechthoek;
+
+ return 0;
+}
diff --git a/week-2/makefile b/week-2/makefile
new file mode 100644
index 0000000..3b71b5b
--- /dev/null
+++ b/week-2/makefile
@@ -0,0 +1,24 @@
+CC = gcc
+LD = gcc
+RM = rm -f
+TARGET = main
+
+LFLAGS += -lstdc++
+
+SRCS := $(wildcard *.cpp)
+OBJS := $(patsubst %.cpp,%.o, $(SRCS))
+
+all: main
+
+%.o: %.cpp
+ $(CC) -c $(CFLAGS) $< -o $@
+
+$(TARGET): $(OBJS)
+ $(LD) $^ $(LFLAGS) -o $@
+
+clean:
+ $(RM) $(TARGET) $(OBJS)
+
+compile_commands: clean
+ compiledb make
+