Have you considered why you're doing this? A program shouldn't go into a failure state unless the input given cannot be used in normal processing. If you have the proper input followed by extraneous data, the program can still run normally. So you should rather be working on ways to handle the extra data if it would effect future input to the program. The simplest solution would be to throw it away.
Code:
#include <iostream>
#include <limits>
#include <string>
using namespace std;
struct seat_number {
int row;
char seat;
};
bool get_seat ( istream& in, seat_number& sn )
{
const string seats ( "abcdef" );
if ( !( in>> sn.row ) || !in.get ( sn.seat ) )
return false;
if ( sn.row < 0 || sn.row > 13 || seats.find ( sn.seat ) == string::npos )
return false;
return true;
}
int main()
{
seat_number sn;
cout<<"Enter seat number: ";
for ( ; ; ) {
if ( get_seat ( cin, sn ) )
cout<<"You chose "<< sn.row << sn.seat <<endl;
else {
cin.clear();
cin.ignore ( numeric_limits<streamsize>::max(), '\n' );
cerr<<"Input error\n";
}
}
}