Code:
while(!(cin >> a))
{
    cin.clear();
    cin.ignore(1000, '\n');
    cout << "Wrong input";
}