Summary Files Commits Branches @commit @diff @stats
path: root / Year 1 / Object-oriented Programming / Solutions Sem. 08 / ex3 / DynStr.cpp
diff options
context:
space:
mode:
Commit763b3710e26fc1e58669927ba59efa5ea2ebc89e (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-04-15 10:35:28 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-04-15 10:35:28 +0300
Files7407671c29eb5c92574cd05958a7524dec6e8b2e /Year 1/Object-oriented Programming/Solutions Sem. 08/ex3/DynStr.cpp
uni-projects-763b3710e26fc1e58669927ba59efa5ea2ebc89e.tar
uni-projects-763b3710e26fc1e58669927ba59efa5ea2ebc89e.tar.gz
uni-projects-763b3710e26fc1e58669927ba59efa5ea2ebc89e.zip
Parentb746daa654ec316331e56a3b243a2dbfb8e59cdb (diff)
Mainly reworked finding to use binary search and also did some smaller tweaks
1 files changed, 1 insertions, 5 deletions
-rw-r--r--Year 1/Object-oriented Programming/Solutions Sem. 08/ex3/DynStr.cpp6
diff --git a/Year 1/Object-oriented Programming/Solutions Sem. 08/ex3/DynStr.cpp b/Year 1/Object-oriented Programming/Solutions Sem. 08/ex3/DynStr.cpp
index 97a2fb4..a7499a8 100644
--- a/Year 1/Object-oriented Programming/Solutions Sem. 08/ex3/DynStr.cpp
+++ b/Year 1/Object-oriented Programming/Solutions Sem. 08/ex3/DynStr.cpp
@@ -50,9 +50,5 @@ const char* DynStr::get_str() const {
}
int DynStr::compare(const char* other) const {
- int cmp = strcmp(str, other);
- // On some compilers (gcc) strcmp returns the difference, but we want it to return -1, 0 or 1
- if (cmp > 1) cmp = 1;
- else if (cmp < -1) cmp = -1;
- return cmp;
+ return strcmp(str, other);
}