If you dont need "choice" dont ask user to enter choice just have them enter 'A' or 'B' I did not get why you want to read "choice A" and then get rid of "choice" from it
Also, cin.getline(num,50,'choice'); doesnt look right, the third (optical) parameter is a single char. You have passed a string encased in single quotes, this is not going to work