int status = input.at(1) - '0';
Here you are implicitly converting a char to an int, which C++ allows. However, the character '2' doesn't become the integer 2. It becomes the integer 50. 50 is the ASCII code for the character '2', as shown here: http://www.ascii-code.com/
Thus to get the integer 2 from the character '2', we need to subtract 48, which is the ASCII code for the character '0'.
Scenario 1, I only wanted
Enter two characters: X1
Invalid major code
Scenario 2, I only wanted
Enter two characters: M0
Invalid status code
That is simply a program flow control issue. Verify the input before line 18.
@integralfx - That if statement is always going to be true. if input[0] is 'C', then != 'M' will be true, making the entire condition true. Ditto for the other two values.
I think that you want to STORE your subject and year (say: string subject, year) and STORE your validity (say: bool validSubject, validYear) rather than using cout immediately in your if and switch blocks.
Then at the end (NOT during your if or switch blocks)
1 2 3 4 5 6 7 8
if ( validSubject && validYear )
{// code to output subject and year}
if ( !validSubject )
{// code to complain about the subject}
if (!validYear )
{// code to complain about the year)
You still aren't doing what @integralfx very sensibly suggested you do: int status = input[1] - '0';