I posted this before but I've done a lot of changes so I hope this is right even though it isn't done. My code compiles, but when I run it, it won't let me enter the string I would like to encode. (Line 20 is where my problem is I believe). I previously used cin>>phrase; there but I couldn't put in spaces. Otherwise when I used cin>>phrase; my program worked exactly as I needed it to.
When you use >> to read input, it leaves the newline (enter press) at the end of the buffer, so when you later go to use getline(), it reads that and thinks you pressed enter (resulting in an empty string). You can use the ignore() method throw away that newline character if you want.