Skip to content

Commit 8d88f11

Browse files
committed
fix menu bugs
1 parent 147a710 commit 8d88f11

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void runMenu() {
5050
std::cout << "Enter choice: ";
5151

5252
int gChoice = readChoice();
53-
if (gChoice == 0) {
53+
if (gChoice == gIndex) {
5454
std::cout << "\n--- Exit ---\n";
5555
break;
5656
}
@@ -77,11 +77,11 @@ void runMenu() {
7777
std::cout << "Enter choice: ";
7878

7979
int eChoice = readChoice();
80-
if (eChoice == 0) {
80+
if (eChoice == eIndex) {
8181
continue;
8282
}
8383

84-
if (eChoice < 1 || eChoice > names.size()) {
84+
if (eChoice < 1 || eChoice > eIndex) {
8585
std::cout << "Invalid example choice\n";
8686
continue;
8787
}

0 commit comments

Comments
 (0)