I just wanted to see whether it is a digit or not but it gave a night of headache

Code:
 
#include <iostream>
#include <cctype>

using namespace std;

int main()
{
    int a;
    cin>>a;
while(!isdigit(a))
{
cout<< "digit only"<< endl;
cin>> a;

}
;
    
    system ("PAUSE");
    return 0;
    
}

Why lord?? WHYYY!!??
Anyway thank you in advance for your attention and help.