btw. add #include<string> to top of that code. Forgot that.
Your code is incomplete. If you post a complete example I can look over in my compiler then i'll take a look. I would urge you to at least check out the string type rather than use char arrays. Always remember main never returns void. It always returns int.Your loops look messy.Stick to the KISS principle and you wont go far wrong.