If statement continuing when false (multiple || and &&)

Solution: I put all of the conditional statements inside of if (!allCorrect[i]) so it looks like this if (!allCorrect[i]) { if (int.TryParse(parameters[i], out INT)) { if (_command.ParameterTypes[i] == EVariableType.INT) { allCorrect[i] = true; } else { allCorrect[i] = false; } } } if (!allCorrect[i]) { if (float.TryParse(parameters[i], out FLOAT)) { if (_command.ParameterTypes[i] == EVariableType.FLOAT) { … Read more

Long condition C++ [closed]

I do not know whether this solution is more efficient, but maybe it is more readable and easier to code: #include <iostream> #include <cstdlib> int main() { const int magicNumber = 32640; const int maxOffset = 1920; int n; std::cin >> n; int y = 20; const std::div_t divresult = std::div(n, magicNumber); if (divresult.rem > … Read more