About using and implementing if statements, I was able to accomplish so, but in a slightly different manner and the program works as expected. The way I implemented if statement is in the following manner:
Hard to make a judgement call with such small examples.
You are not required to nest your ifs. I normally nest, but I find your code easier to read since the Bulls condition and the Cows conditions are fully separated. If you mind works this way you should not make changes to suit some arbitrary coding standard.
The case for nested if’ statements is
two lines to retype if anything changes in the character comparison
work is potentially being done twice.
In this example game you won’t notice the performance difference, but as written the code will check the characters once when the character is a Bulls match, but twice when there is no match for Bulls. The nested version only does the comparison once.
Bulls
Guess[j] == MyHiddenWord[i] && i==j
When there is no match this code compares the characters again.
Guess[j] == MyHiddenWord[i] && i != j