How to compare invalid input for a menu
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I have a problem in getcombo
function. I want to check if the value entered by the user is within the menu option range (1-4). So I compare the value entered by the user with integer values such as 1, 2, 3 and 4 with an if else
statement. But even when the user enter correct value the programm still ask the user to enter the value again.
INCLUDE Irvine32.inc
.data
MAX = 80
userInput BYTE MAX+1 DUP (?)
msgName BYTE 'Enter Your Name : ' ,0
msgPass BYTE 'Enter Your Password : ' , 0
comboTitle BYTE'COMBO Meals',0
line1 BYTE'==================',0
line2 BYTE'==================',0
comboMeal1 BYTE '1) Chicken Burger + Coca Cola + Cheesy Wedges | RM 15.00',0
comboMeal2 BYTE '2) Grilled Beef Burger + Pepsi + French Fries | RM 17.00',0
comboMeal3 BYTE '3) Spicy Korean Wings + Coca Cola + salad | RM 10.00',0
comboMeal4 BYTE '4) Chicken Pizza + mountain dew + minched Potato | RM 20.00',0
selectedCombo BYTE ' ',0
prompt1 BYTE 'Please select a Combo Meal : ',0
mealPrice1 dword 15.00
mealPrice2 dword 17.00
mealPrice3 dword 10.00
mealPrice4 dword 20.00
invalidLogin BYTE 'Invalid' , 0
invalidSelection BYTE'Please select within given menu option',0
validPass BYTE 'Valid Password' , 0
loginPassword BYTE "123" , 0
loginName BYTE "bob" , 0
.code
main PROC
Login :
;---------------- Display "Enter Your Name"
mov edx,OFFSET msgName
call WriteString
;---------------- Get name input
call GetInput
;---------------- compare user input and name
mov ebx , OFFSET loginName
.IF eax == [ebx]
;--------------- Correct input
;---------------- Display "Enter Your Password"
mov edx,OFFSET msgPass
call WriteString
;---------------- Get password input
call GetInput
;--------------- compare user input and password
mov ebx , OFFSET loginPassword
.IF eax == [ebx]
;--------------Correct input
jmp displayMenu
.ELSE
;--------------- Incorrect input
jmp InvalidInput
.ENDIF
;---------------
.ELSE
;-------------- Incorrect input
jmp InvalidInput
.ENDIF
InvalidInput :
;---------------Display "Invalid"
mov edx,OFFSET invalidLogin
call WriteString
call Crlf
;--------------- Repeat process
jmp Login
invalidMenuSelect:
xor edx,edx
mov edx, OFFSET invalidSelection
call WriteString
call Crlf
jmp getCombo
display:
mov edx,OFFSET validPass
call WriteString
displayMenu :
mov edx,OFFSET line1
call WriteString
call Crlf
xor edx,edx
mov edx,OFFSET comboTitle
call WriteString
call Crlf
xor edx,edx
mov edx,OFFSET line1
call WriteString
call Crlf
xor edx,edx
mov edx,OFFSET comboMeal1
call WriteString
call Crlf
xor edx,edx
mov edx,OFFSET comboMeal2
call WriteString
call Crlf
xor edx,edx
mov edx,OFFSET comboMeal3
call WriteString
call Crlf
xor edx,edx
mov edx,OFFSET comboMeal4
call WriteString
call Crlf
xor edx,edx
call Crlf
mov edx,OFFSET prompt1
call WriteString
call Crlf
xor edx,edx
jmp getCombo
exit
getCombo :
call GetInput
.IF eax == '1'
xor edx,edx
mov edx, OFFSET comboMeal1
;mov selectedCombo , edx
.ELSEIF eax == '2'
xor edx,edx
mov edx, OFFSET comboMeal2
;mov selectedCombo , edx
.ELSEIF eax == '3'
xor edx,edx
mov edx, OFFSET comboMeal3
;mov selectedCombo , edx
.ELSEIF eax == '4'
xor edx,edx
mov edx, OFFSET comboMeal4
;mov selectedCombo , edx
.ELSE
jmp invalidMenuSelect
.ENDIF
main ENDP
GetInput PROC
;-------------
;Get User input
;-------------
xor eax,eax
mov edx,OFFSET userInput
mov ecx,MAX
call ReadString
mov eax,[edx]
ret
GetInput ENDP
END main
visual-studio assembly x86 irvine32
add a comment |
I have a problem in getcombo
function. I want to check if the value entered by the user is within the menu option range (1-4). So I compare the value entered by the user with integer values such as 1, 2, 3 and 4 with an if else
statement. But even when the user enter correct value the programm still ask the user to enter the value again.
INCLUDE Irvine32.inc
.data
MAX = 80
userInput BYTE MAX+1 DUP (?)
msgName BYTE 'Enter Your Name : ' ,0
msgPass BYTE 'Enter Your Password : ' , 0
comboTitle BYTE'COMBO Meals',0
line1 BYTE'==================',0
line2 BYTE'==================',0
comboMeal1 BYTE '1) Chicken Burger + Coca Cola + Cheesy Wedges | RM 15.00',0
comboMeal2 BYTE '2) Grilled Beef Burger + Pepsi + French Fries | RM 17.00',0
comboMeal3 BYTE '3) Spicy Korean Wings + Coca Cola + salad | RM 10.00',0
comboMeal4 BYTE '4) Chicken Pizza + mountain dew + minched Potato | RM 20.00',0
selectedCombo BYTE ' ',0
prompt1 BYTE 'Please select a Combo Meal : ',0
mealPrice1 dword 15.00
mealPrice2 dword 17.00
mealPrice3 dword 10.00
mealPrice4 dword 20.00
invalidLogin BYTE 'Invalid' , 0
invalidSelection BYTE'Please select within given menu option',0
validPass BYTE 'Valid Password' , 0
loginPassword BYTE "123" , 0
loginName BYTE "bob" , 0
.code
main PROC
Login :
;---------------- Display "Enter Your Name"
mov edx,OFFSET msgName
call WriteString
;---------------- Get name input
call GetInput
;---------------- compare user input and name
mov ebx , OFFSET loginName
.IF eax == [ebx]
;--------------- Correct input
;---------------- Display "Enter Your Password"
mov edx,OFFSET msgPass
call WriteString
;---------------- Get password input
call GetInput
;--------------- compare user input and password
mov ebx , OFFSET loginPassword
.IF eax == [ebx]
;--------------Correct input
jmp displayMenu
.ELSE
;--------------- Incorrect input
jmp InvalidInput
.ENDIF
;---------------
.ELSE
;-------------- Incorrect input
jmp InvalidInput
.ENDIF
InvalidInput :
;---------------Display "Invalid"
mov edx,OFFSET invalidLogin
call WriteString
call Crlf
;--------------- Repeat process
jmp Login
invalidMenuSelect:
xor edx,edx
mov edx, OFFSET invalidSelection
call WriteString
call Crlf
jmp getCombo
display:
mov edx,OFFSET validPass
call WriteString
displayMenu :
mov edx,OFFSET line1
call WriteString
call Crlf
xor edx,edx
mov edx,OFFSET comboTitle
call WriteString
call Crlf
xor edx,edx
mov edx,OFFSET line1
call WriteString
call Crlf
xor edx,edx
mov edx,OFFSET comboMeal1
call WriteString
call Crlf
xor edx,edx
mov edx,OFFSET comboMeal2
call WriteString
call Crlf
xor edx,edx
mov edx,OFFSET comboMeal3
call WriteString
call Crlf
xor edx,edx
mov edx,OFFSET comboMeal4
call WriteString
call Crlf
xor edx,edx
call Crlf
mov edx,OFFSET prompt1
call WriteString
call Crlf
xor edx,edx
jmp getCombo
exit
getCombo :
call GetInput
.IF eax == '1'
xor edx,edx
mov edx, OFFSET comboMeal1
;mov selectedCombo , edx
.ELSEIF eax == '2'
xor edx,edx
mov edx, OFFSET comboMeal2
;mov selectedCombo , edx
.ELSEIF eax == '3'
xor edx,edx
mov edx, OFFSET comboMeal3
;mov selectedCombo , edx
.ELSEIF eax == '4'
xor edx,edx
mov edx, OFFSET comboMeal4
;mov selectedCombo , edx
.ELSE
jmp invalidMenuSelect
.ENDIF
main ENDP
GetInput PROC
;-------------
;Get User input
;-------------
xor eax,eax
mov edx,OFFSET userInput
mov ecx,MAX
call ReadString
mov eax,[edx]
ret
GetInput ENDP
END main
visual-studio assembly x86 irvine32
1
YourGetInput
processes 4 bytes of the string not 1.
– Jester
Jan 3 at 12:17
This is very far from a Minimal, Complete, and Verifiable example. It's nowhere near minimal, full of bloated menu-printing code. You could just put the whole thing in one big string that contains newlines, or you could loop over an array. (And use the same array for menu selection using an integer index, instead of an if/else chain). It's also pointless to have two separateline1
andline2
with the same contents. Anyway, use your debugger and check the values of your registers.
– Peter Cordes
Jan 3 at 12:21
add a comment |
I have a problem in getcombo
function. I want to check if the value entered by the user is within the menu option range (1-4). So I compare the value entered by the user with integer values such as 1, 2, 3 and 4 with an if else
statement. But even when the user enter correct value the programm still ask the user to enter the value again.
INCLUDE Irvine32.inc
.data
MAX = 80
userInput BYTE MAX+1 DUP (?)
msgName BYTE 'Enter Your Name : ' ,0
msgPass BYTE 'Enter Your Password : ' , 0
comboTitle BYTE'COMBO Meals',0
line1 BYTE'==================',0
line2 BYTE'==================',0
comboMeal1 BYTE '1) Chicken Burger + Coca Cola + Cheesy Wedges | RM 15.00',0
comboMeal2 BYTE '2) Grilled Beef Burger + Pepsi + French Fries | RM 17.00',0
comboMeal3 BYTE '3) Spicy Korean Wings + Coca Cola + salad | RM 10.00',0
comboMeal4 BYTE '4) Chicken Pizza + mountain dew + minched Potato | RM 20.00',0
selectedCombo BYTE ' ',0
prompt1 BYTE 'Please select a Combo Meal : ',0
mealPrice1 dword 15.00
mealPrice2 dword 17.00
mealPrice3 dword 10.00
mealPrice4 dword 20.00
invalidLogin BYTE 'Invalid' , 0
invalidSelection BYTE'Please select within given menu option',0
validPass BYTE 'Valid Password' , 0
loginPassword BYTE "123" , 0
loginName BYTE "bob" , 0
.code
main PROC
Login :
;---------------- Display "Enter Your Name"
mov edx,OFFSET msgName
call WriteString
;---------------- Get name input
call GetInput
;---------------- compare user input and name
mov ebx , OFFSET loginName
.IF eax == [ebx]
;--------------- Correct input
;---------------- Display "Enter Your Password"
mov edx,OFFSET msgPass
call WriteString
;---------------- Get password input
call GetInput
;--------------- compare user input and password
mov ebx , OFFSET loginPassword
.IF eax == [ebx]
;--------------Correct input
jmp displayMenu
.ELSE
;--------------- Incorrect input
jmp InvalidInput
.ENDIF
;---------------
.ELSE
;-------------- Incorrect input
jmp InvalidInput
.ENDIF
InvalidInput :
;---------------Display "Invalid"
mov edx,OFFSET invalidLogin
call WriteString
call Crlf
;--------------- Repeat process
jmp Login
invalidMenuSelect:
xor edx,edx
mov edx, OFFSET invalidSelection
call WriteString
call Crlf
jmp getCombo
display:
mov edx,OFFSET validPass
call WriteString
displayMenu :
mov edx,OFFSET line1
call WriteString
call Crlf
xor edx,edx
mov edx,OFFSET comboTitle
call WriteString
call Crlf
xor edx,edx
mov edx,OFFSET line1
call WriteString
call Crlf
xor edx,edx
mov edx,OFFSET comboMeal1
call WriteString
call Crlf
xor edx,edx
mov edx,OFFSET comboMeal2
call WriteString
call Crlf
xor edx,edx
mov edx,OFFSET comboMeal3
call WriteString
call Crlf
xor edx,edx
mov edx,OFFSET comboMeal4
call WriteString
call Crlf
xor edx,edx
call Crlf
mov edx,OFFSET prompt1
call WriteString
call Crlf
xor edx,edx
jmp getCombo
exit
getCombo :
call GetInput
.IF eax == '1'
xor edx,edx
mov edx, OFFSET comboMeal1
;mov selectedCombo , edx
.ELSEIF eax == '2'
xor edx,edx
mov edx, OFFSET comboMeal2
;mov selectedCombo , edx
.ELSEIF eax == '3'
xor edx,edx
mov edx, OFFSET comboMeal3
;mov selectedCombo , edx
.ELSEIF eax == '4'
xor edx,edx
mov edx, OFFSET comboMeal4
;mov selectedCombo , edx
.ELSE
jmp invalidMenuSelect
.ENDIF
main ENDP
GetInput PROC
;-------------
;Get User input
;-------------
xor eax,eax
mov edx,OFFSET userInput
mov ecx,MAX
call ReadString
mov eax,[edx]
ret
GetInput ENDP
END main
visual-studio assembly x86 irvine32
I have a problem in getcombo
function. I want to check if the value entered by the user is within the menu option range (1-4). So I compare the value entered by the user with integer values such as 1, 2, 3 and 4 with an if else
statement. But even when the user enter correct value the programm still ask the user to enter the value again.
INCLUDE Irvine32.inc
.data
MAX = 80
userInput BYTE MAX+1 DUP (?)
msgName BYTE 'Enter Your Name : ' ,0
msgPass BYTE 'Enter Your Password : ' , 0
comboTitle BYTE'COMBO Meals',0
line1 BYTE'==================',0
line2 BYTE'==================',0
comboMeal1 BYTE '1) Chicken Burger + Coca Cola + Cheesy Wedges | RM 15.00',0
comboMeal2 BYTE '2) Grilled Beef Burger + Pepsi + French Fries | RM 17.00',0
comboMeal3 BYTE '3) Spicy Korean Wings + Coca Cola + salad | RM 10.00',0
comboMeal4 BYTE '4) Chicken Pizza + mountain dew + minched Potato | RM 20.00',0
selectedCombo BYTE ' ',0
prompt1 BYTE 'Please select a Combo Meal : ',0
mealPrice1 dword 15.00
mealPrice2 dword 17.00
mealPrice3 dword 10.00
mealPrice4 dword 20.00
invalidLogin BYTE 'Invalid' , 0
invalidSelection BYTE'Please select within given menu option',0
validPass BYTE 'Valid Password' , 0
loginPassword BYTE "123" , 0
loginName BYTE "bob" , 0
.code
main PROC
Login :
;---------------- Display "Enter Your Name"
mov edx,OFFSET msgName
call WriteString
;---------------- Get name input
call GetInput
;---------------- compare user input and name
mov ebx , OFFSET loginName
.IF eax == [ebx]
;--------------- Correct input
;---------------- Display "Enter Your Password"
mov edx,OFFSET msgPass
call WriteString
;---------------- Get password input
call GetInput
;--------------- compare user input and password
mov ebx , OFFSET loginPassword
.IF eax == [ebx]
;--------------Correct input
jmp displayMenu
.ELSE
;--------------- Incorrect input
jmp InvalidInput
.ENDIF
;---------------
.ELSE
;-------------- Incorrect input
jmp InvalidInput
.ENDIF
InvalidInput :
;---------------Display "Invalid"
mov edx,OFFSET invalidLogin
call WriteString
call Crlf
;--------------- Repeat process
jmp Login
invalidMenuSelect:
xor edx,edx
mov edx, OFFSET invalidSelection
call WriteString
call Crlf
jmp getCombo
display:
mov edx,OFFSET validPass
call WriteString
displayMenu :
mov edx,OFFSET line1
call WriteString
call Crlf
xor edx,edx
mov edx,OFFSET comboTitle
call WriteString
call Crlf
xor edx,edx
mov edx,OFFSET line1
call WriteString
call Crlf
xor edx,edx
mov edx,OFFSET comboMeal1
call WriteString
call Crlf
xor edx,edx
mov edx,OFFSET comboMeal2
call WriteString
call Crlf
xor edx,edx
mov edx,OFFSET comboMeal3
call WriteString
call Crlf
xor edx,edx
mov edx,OFFSET comboMeal4
call WriteString
call Crlf
xor edx,edx
call Crlf
mov edx,OFFSET prompt1
call WriteString
call Crlf
xor edx,edx
jmp getCombo
exit
getCombo :
call GetInput
.IF eax == '1'
xor edx,edx
mov edx, OFFSET comboMeal1
;mov selectedCombo , edx
.ELSEIF eax == '2'
xor edx,edx
mov edx, OFFSET comboMeal2
;mov selectedCombo , edx
.ELSEIF eax == '3'
xor edx,edx
mov edx, OFFSET comboMeal3
;mov selectedCombo , edx
.ELSEIF eax == '4'
xor edx,edx
mov edx, OFFSET comboMeal4
;mov selectedCombo , edx
.ELSE
jmp invalidMenuSelect
.ENDIF
main ENDP
GetInput PROC
;-------------
;Get User input
;-------------
xor eax,eax
mov edx,OFFSET userInput
mov ecx,MAX
call ReadString
mov eax,[edx]
ret
GetInput ENDP
END main
visual-studio assembly x86 irvine32
visual-studio assembly x86 irvine32
edited Jan 3 at 14:54
GMachado
574619
574619
asked Jan 3 at 12:14
Harvinderan ChandranHarvinderan Chandran
31
31
1
YourGetInput
processes 4 bytes of the string not 1.
– Jester
Jan 3 at 12:17
This is very far from a Minimal, Complete, and Verifiable example. It's nowhere near minimal, full of bloated menu-printing code. You could just put the whole thing in one big string that contains newlines, or you could loop over an array. (And use the same array for menu selection using an integer index, instead of an if/else chain). It's also pointless to have two separateline1
andline2
with the same contents. Anyway, use your debugger and check the values of your registers.
– Peter Cordes
Jan 3 at 12:21
add a comment |
1
YourGetInput
processes 4 bytes of the string not 1.
– Jester
Jan 3 at 12:17
This is very far from a Minimal, Complete, and Verifiable example. It's nowhere near minimal, full of bloated menu-printing code. You could just put the whole thing in one big string that contains newlines, or you could loop over an array. (And use the same array for menu selection using an integer index, instead of an if/else chain). It's also pointless to have two separateline1
andline2
with the same contents. Anyway, use your debugger and check the values of your registers.
– Peter Cordes
Jan 3 at 12:21
1
1
Your
GetInput
processes 4 bytes of the string not 1.– Jester
Jan 3 at 12:17
Your
GetInput
processes 4 bytes of the string not 1.– Jester
Jan 3 at 12:17
This is very far from a Minimal, Complete, and Verifiable example. It's nowhere near minimal, full of bloated menu-printing code. You could just put the whole thing in one big string that contains newlines, or you could loop over an array. (And use the same array for menu selection using an integer index, instead of an if/else chain). It's also pointless to have two separate
line1
and line2
with the same contents. Anyway, use your debugger and check the values of your registers.– Peter Cordes
Jan 3 at 12:21
This is very far from a Minimal, Complete, and Verifiable example. It's nowhere near minimal, full of bloated menu-printing code. You could just put the whole thing in one big string that contains newlines, or you could loop over an array. (And use the same array for menu selection using an integer index, instead of an if/else chain). It's also pointless to have two separate
line1
and line2
with the same contents. Anyway, use your debugger and check the values of your registers.– Peter Cordes
Jan 3 at 12:21
add a comment |
1 Answer
1
active
oldest
votes
The problem with your code is that the ReadString function you are using for input is adding the new line feed character to the eax register. To fix your issue, you can just check .IF al == '1'
and so on. A better approach would be to use the Irvine library function ReadChar
then check the al register.
code example
Please provide code as code, not as screenshots. see help center and How to Answer for details
– JoSSte
Jan 4 at 8:02
thank you. your opinion helped me to resolve my problem.
– Harvinderan Chandran
Jan 9 at 10:41
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54022093%2fhow-to-compare-invalid-input-for-a-menu%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The problem with your code is that the ReadString function you are using for input is adding the new line feed character to the eax register. To fix your issue, you can just check .IF al == '1'
and so on. A better approach would be to use the Irvine library function ReadChar
then check the al register.
code example
Please provide code as code, not as screenshots. see help center and How to Answer for details
– JoSSte
Jan 4 at 8:02
thank you. your opinion helped me to resolve my problem.
– Harvinderan Chandran
Jan 9 at 10:41
add a comment |
The problem with your code is that the ReadString function you are using for input is adding the new line feed character to the eax register. To fix your issue, you can just check .IF al == '1'
and so on. A better approach would be to use the Irvine library function ReadChar
then check the al register.
code example
Please provide code as code, not as screenshots. see help center and How to Answer for details
– JoSSte
Jan 4 at 8:02
thank you. your opinion helped me to resolve my problem.
– Harvinderan Chandran
Jan 9 at 10:41
add a comment |
The problem with your code is that the ReadString function you are using for input is adding the new line feed character to the eax register. To fix your issue, you can just check .IF al == '1'
and so on. A better approach would be to use the Irvine library function ReadChar
then check the al register.
code example
The problem with your code is that the ReadString function you are using for input is adding the new line feed character to the eax register. To fix your issue, you can just check .IF al == '1'
and so on. A better approach would be to use the Irvine library function ReadChar
then check the al register.
code example
edited Jan 4 at 9:20
JoSSte
1,07921833
1,07921833
answered Jan 4 at 7:44
WINNWINN
161
161
Please provide code as code, not as screenshots. see help center and How to Answer for details
– JoSSte
Jan 4 at 8:02
thank you. your opinion helped me to resolve my problem.
– Harvinderan Chandran
Jan 9 at 10:41
add a comment |
Please provide code as code, not as screenshots. see help center and How to Answer for details
– JoSSte
Jan 4 at 8:02
thank you. your opinion helped me to resolve my problem.
– Harvinderan Chandran
Jan 9 at 10:41
Please provide code as code, not as screenshots. see help center and How to Answer for details
– JoSSte
Jan 4 at 8:02
Please provide code as code, not as screenshots. see help center and How to Answer for details
– JoSSte
Jan 4 at 8:02
thank you. your opinion helped me to resolve my problem.
– Harvinderan Chandran
Jan 9 at 10:41
thank you. your opinion helped me to resolve my problem.
– Harvinderan Chandran
Jan 9 at 10:41
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54022093%2fhow-to-compare-invalid-input-for-a-menu%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Your
GetInput
processes 4 bytes of the string not 1.– Jester
Jan 3 at 12:17
This is very far from a Minimal, Complete, and Verifiable example. It's nowhere near minimal, full of bloated menu-printing code. You could just put the whole thing in one big string that contains newlines, or you could loop over an array. (And use the same array for menu selection using an integer index, instead of an if/else chain). It's also pointless to have two separate
line1
andline2
with the same contents. Anyway, use your debugger and check the values of your registers.– Peter Cordes
Jan 3 at 12:21