I have the following code that works correctly. However after I add an else statement anything always evaluates to else
wgetstr(inputWin, ch); //get line and store in ch variable
str = ch; //make input from char* to string
if(str=="m" || str=="M"){
showFeedback("Data Memory Updated");
}
if(str=="p" || str=="P"){
showFeedback("Program Memory Updated");
}
if(str=="g" || str=="G"){
showFeedback("Accumulator, Program Counter, Zero Result Updated");
}
if(str=="e" || str=="E"){
showFeedback("Editing Mode Enabled");
}
if(str=="c" || str=="C"){
showFeedback("Program Copied Into Program Memory");
}
if(str=="r" || str=="R"){
showFeedback("Executing Program");
}
if(str=="x" || str=="X"){
showFeedback("Program Exited");
}
All the previous evaluates correctly based on what the input is. i.e If I enter "m" it calls the showeFeedback("Data Memory Updated") on so on, but if I add the following else statement, I always get "Invalid Command Entered" no matter what I enter.
else{
showFeedback("Invalid Command Entered");
}