The ONLY way to get into an "else" clause is for the "if" to be false. Since the "if", in this case, is
the ONLY way to get into the "else" clause is for temp to equal one of those five strings. So checking when you're in the else clause is too late -- you've already done the checking, that's why you're there.Code:if ( (temp != "INX") && (temp != "LAX" ) && (temp != "LDX") && (temp != "DEX") && (temp != "CLX" )
Look at your code again:
All the things in bright green don't happen when temp == "not needed". But yet you print out CommandsBinaryString anyway, at the bottom.Code:void CLA::machinLanguageConvertor()
{
string temp;
temp = commandnameptr;
int argument = 0;
if ( temp != "not needed" )
{
argument = Atoi(offsetptr);
offsetptr = Oct2Bin( argument );
if ( (temp != "INX") && (temp != "LAX" ) && (temp != "LDX") && (temp != "DEX") && (temp != "CLX" ) )
{
CommandsBinaryString = BinaryDetector( commandnameptr );
CommandsBinaryString.append(mixstateptr);
CommandsBinaryString.append(offsetptr);
}
///Error .Inx wont work.
else
{
CommandsBinaryString = commandnameptr;
}
}
cout<<"Binary Instruction = "<<CommandsBinaryString;
}
