aboutsummaryrefslogtreecommitdiff
path: root/week-1
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-09-08 09:22:46 +0200
committerlonkaars <loek@pipeframe.xyz>2022-09-08 09:22:46 +0200
commite15333e1987bda84fd787eec8e78ea98f95a77a7 (patch)
tree3f3b474e5eb10629a73dbcf39a5c849786e4f85a /week-1
week 1/2 huiswerk toegevoegd
Diffstat (limited to 'week-1')
-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
4 files changed, 71 insertions, 0 deletions
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