it ran fine for me, but its wonky.
your I/O for message and key forces me to enter the data, then enter a bogus line, then enter the key... etc
I think you are misusing the cin.ignore(). Take another look at that.
you don't need a loop to toupper, look at std::transform(). not important, just a little cleaner. you can do it with cast too, but my personal opinion casting should not modify, so I don't use that way.