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;
    cout<<"sample is a char";
    else if(isdigit(sample))
    cout<<"sample is an integer";
    return 0;

Edited 5 Years Ago by king03: n/a

This question has already been answered. Start a new discussion instead.