While creating pseudo code ... I went onto to create the Isogram checking loop

I don’t know why but while i start to create a pseudo code…I always get drifted away and start to code instead.
This has been not covered so far in lecture 63 but still somehow i figured out the loop and also it is working upon compiling in Unreal.
Don’t know how instructors are going to approach it but here is my Isogram checking code.

bool UBullCowCartridge::IsIsogram(FString Word)
{
    for (int32 i=0; i<=Word.Len()-1; i++)
    {
        TCHAR CheckChar = Word[i];

        for (int32 f= i+1; f<=Word.Len()-1;f++) 
        {
            if (CheckChar == Word[f])
            {
                PrintLine(TEXT("Oops, you have repeated a letter"));
                PrintLine(TEXT("You need to write an Isogram"));                
            }       
        }    
    } 
    return true; 
}

Kindly correct me if I’m wrong anywhere.
Thank You

1 Like

I love your Isogram code. Curious did you follow understand the lecture? Do you think you could explain back in a few short words?

Well when Instructor gave us the challenge to create a pseudo code for isogram check he hinted us with the nested loops. He clearly hinted that we will have to create a loop where we will be picking each letter one by one and then create another loop to check for the same letter. That’s when I drifted away from the pseudo code and just started to think about the code.
Now when I have reached to the lecture where Instructors have explained the Isogram checking loop… their loop makes more sense…
There was no need to create a TCHAR. I created TCHAR CheckChar = WORD[i]; to store the letter for comparing it with the other letters of input.

Also I would like to know that Instructors have told that not to use <= else Unreal will crash… while in my it didn’t crash… so should I go with my code or should I alter it the way Instructors have done?

THANKS

Privacy & Terms