aboutsummaryrefslogtreecommitdiff
path: root/week05
diff options
context:
space:
mode:
authorKamen Mladenov <kamen@syndamia.com>2024-04-02 16:49:21 +0300
committerGitHub <noreply@github.com>2024-04-02 16:49:21 +0300
commit6a8154ad7f2cbfbb2ae4f2ddda1cd0db0e430e44 (patch)
tree401d46571a3f59fc23454eba3e37bc52d8612488 /week05
parentfa99ad53c4c730df853f90f4ffe7a0855ecbc559 (diff)
downloadoop-2023-solutions-6a8154ad7f2cbfbb2ae4f2ddda1cd0db0e430e44.tar
oop-2023-solutions-6a8154ad7f2cbfbb2ae4f2ddda1cd0db0e430e44.tar.gz
oop-2023-solutions-6a8154ad7f2cbfbb2ae4f2ddda1cd0db0e430e44.zip
[w5/ex1] Updated logic for patient removal
Diffstat (limited to 'week05')
-rw-r--r--week05/Exercise1.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/week05/Exercise1.cpp b/week05/Exercise1.cpp
index 28fc290..7fdaa7d 100644
--- a/week05/Exercise1.cpp
+++ b/week05/Exercise1.cpp
@@ -24,9 +24,10 @@ public:
patients[lastIndex++] = newPatient;
}
- // По принцип логиката трябва да е по-сложна, да се маха пациент по индекс и
- // след това да се изместват останалите, но за целите на задачата това не е нужно
- void RemovePatient() {
+ void RemovePatient(int index) {
+ for (int i = index; i < lastIndex - 1; i++) {
+ patients[i] = patients[i+1];
+ }
lastIndex--;
}
};