I have a signed integer variable when I do this in main, it is giving me "Error" for integer values as well.
int main(){
unsigned int a;
while(cin>>a){
if(!isdigit(a)){
cout<<"Error"<<endl;
}
}
}
[EDIT]: Thanks to all the responses, I understood the issue. Now, how do I check if cin is reading integer only and not alphabets or any other character. Is there any function for that in c++. Thanks