Anagram Detector

A program that when given a word or phrase checks to see if it is an anagram for a single English word.

Download From Mediafire GitHub Repo

image-center

For example the word “silent” returns:

  • enlist
  • inlets
  • listen
  • silent
  • slinte
  • tinsel

RedRum returns murder

Program was made using:

The program is cross platform compilable with Windows, Linux and it should compile with MacOS but it hasn’t been tested due to lack of owning a Mac.

This was made more or less just to see if I could cross compile an OpenGl program between Windows and Linux.

I am rather proud of the way I check for anagrams although I’m sure someone has come up with a better solution before.

1) Copy input to a second variable and rearrange all the letters be in alphabetical order

2) Clone our provided dictionary and rearrange the clones words to have it’s letters all be alphabetical as well

3) Compare the alphabetical input to the alphabetical dictionary, if they match copy the matching dictionary word to the output box

So for example “silent” becomes “eilnst” and now when we do the compares it’s a quick check to see if they match. If they do that means it’s an anagram. Pretty simple huh?

In the future I would like to give it the ability to check for multiple words, phrases, and sub words. I think I could further optimize that above function as well.

Word list is from https://github.com/dwyl/english-words