Hi there guys I need some help I am creating an inventory with loads of exception handlers, I got a problem with isalpha and isdigit because supposedly it will detect whether an input is a char or a digit... Ok I tested a simple program to show my problem. I only used if-else in this code for it to be less complicated. When I type in a letter or a number it just proceeds to press any key to continue... Can somebody figure out what's wrong with this?
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
int main()
{
int sample;
cin>>sample;
if(isalpha(sample))
cout<<"sample is a char";
else if(isdigit(sample))
cout<<"sample is an integer";
system("pause");
return 0;
}