Google
 
Webcprogramming.com




An Affiliate of AIHorizon




isalpha()

Prototype: int isalpha(int character);
Header File: ctype.h (C) or cctype (C++)
Explanation: Even though it accepts an int, it really deals with characters. Based on the ASCII value of the character it will determine if it is an alphabetical character or not.
Example:
//Program accepts a user input, and checks to see if it is a letter
#include <cctype>
#include <iostream>

using namespace std;

int main()
{
    char d;
    cout<<"Enter a character, number, or punction sign: ";
    cin>>d;
    if(isalpha(d))
    {
        cout<<"You entered an alphabetical character.";
    }
}
Other Functions


-----
Interested in advertising with us?
Please read our privacy policy.
Copyright © 1997-2005 Cprogramming.com. All rights reserved.
Designs