diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-11-09 11:48:12 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-11-09 11:48:12 +0100 |
commit | ffae2cb77bfb3263146a2de0deedf6528d4df461 (patch) | |
tree | 88e4b61087069f8ce5badadbc6264d20b8a051d5 /oop1w1 | |
parent | d797758769d033c64babdf77ea6b64262f792b23 (diff) |
repository aanpassen voor oop2
Diffstat (limited to 'oop1w1')
-rw-r--r-- | oop1w1/Opteller.cpp | 13 | ||||
-rw-r--r-- | oop1w1/Opteller.h | 12 | ||||
-rw-r--r-- | oop1w1/main.cpp | 24 | ||||
l--------- | oop1w1/makefile | 1 |
4 files changed, 50 insertions, 0 deletions
diff --git a/oop1w1/Opteller.cpp b/oop1w1/Opteller.cpp new file mode 100644 index 0000000..41efee0 --- /dev/null +++ b/oop1w1/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/oop1w1/Opteller.h b/oop1w1/Opteller.h new file mode 100644 index 0000000..2f21d79 --- /dev/null +++ b/oop1w1/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/oop1w1/main.cpp b/oop1w1/main.cpp new file mode 100644 index 0000000..0d895f4 --- /dev/null +++ b/oop1w1/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/oop1w1/makefile b/oop1w1/makefile new file mode 120000 index 0000000..a4e84c6 --- /dev/null +++ b/oop1w1/makefile @@ -0,0 +1 @@ +../week.mk
\ No newline at end of file |