Website Summary Files Commits Branches @commit @diff @stats
path: root / src
diff options
context:
space:
mode:
2 files changed, 9 insertions, 8 deletions
-rw-r--r--src/ConsoleInterface/Menu.cpp9
-rw-r--r--src/List/List.hpp8
diff --git a/src/ConsoleInterface/Menu.cpp b/src/ConsoleInterface/Menu.cpp
index 190fe42..58477df 100644
--- a/src/ConsoleInterface/Menu.cpp
+++ b/src/ConsoleInterface/Menu.cpp
@@ -17,7 +17,7 @@ void Menu::navigate() const {
return;
}
- resetOrderedList();
+ resetOrderedList(0);
printOrderedListElem("Go Back");
for (unsigned i = 0; i < menuOptions.get_count(); i++)
printOrderedListElem(menuOptions[i].get_nameInMenu());
@@ -28,9 +28,8 @@ void Menu::navigate() const {
print(menuOptions.get_count());
print("]: ");
read(buffer);
- }
-
- if (buffer == 0) return;
- menuOptions[buffer - 1].run();
+ if (buffer == 0) return;
+ menuOptions[buffer].run();
+ }
}
diff --git a/src/List/List.hpp b/src/List/List.hpp
index 1e75c89..7088f2e 100644
--- a/src/List/List.hpp
+++ b/src/List/List.hpp
@@ -70,9 +70,11 @@ void List<T>::copyFrom(const List& other) {
template <class T>
List<T>::List(const T* elements, unsigned elementsCount) {
- count = length = 0;
- for (unsigned i = 0; i < elementsCount; i++)
- add(elements[i]);
+ length = 8;
+ count = elementsCount;
+ this->elements = new T[length];
+ for (unsigned i = 0; i < count; i++)
+ this->elements[i] = elements[i];
}
template <class T>