For code tags you must use square brackets not angular ones. cin >> A[14]; is wrong. It is a little confusing that you can use the square brackets to mean two things in C++. char A[14] means that you declare the A array with 14 elements, numbered from 0 to 13. Next time you use cin >> A[14]; means that you want to read only one character, and you assign it to index 14, which is out of bounds.