First of all thanks so much for all the effort that has been put into this course, it is one of the better ones I have done on udemy. So much so this is the first time I have ever posted in an external discussion, mainly because I don’t really follow the course all that much, by that I mean I watch the lectures then expand heavily on things. An example of this is in this lecture we were asked to only do error checking on the length of the Guess. Well, I went ahead and added a whole bunch more for other scenarios and thought I would share the code for anyone else who would like to see the code and to also encourage people to not just stick to what the course tells you to do, make it your own.!
I feel the only function that might need explaining is CheckIsogram:
int32 GuessLength = Guess.length();
Just getting the length for the loop
for (int32 i = 0; i < GuessLength; i++)
{
Guess[i] = tolower(Guess[i]);
}
converting all characters to lower case to avoid any errors
std::sort(Guess.begin(), Guess.end());
Arrange all the letters in the guess in ascending order e.g. a,b,c,d
for (int32 i = 0; i < GuessLength; i++)
{
if (Guess[i] == Guess[i + 1])
{
return false;
}
else
{
return true;
}
}
Loop where we compare the Current guess in the array to the next letter in the array if they match we return false.