please help me guys :).
I found several articles about preventing the user from entering characters but I can't understand them.

int num_sub;//subjects

setcolor(143);
cout<<"Enter the number of subjects:"<<" ";
setcolor(15);
cin>>num_sub;
if(isdigit(num_sub)==0){
cout<<"CONTINUE";

                 }
else{ cout<< "\n numbers only!"; exit(0); }

here in my code: when I enter a number, it will display "CONTINUE" but when I enter a character it will display "continue" instead of the warning "numbers only"

I am making a program that will compute the General weighted average of a student.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.