ispunct()

Prototype: int ispunct (int c);
Header File: ctype.h (C) or cctype (C++)
Explanation: Tests if the ASCII character corresponding to the integer stored in c is a punctuation character.



#include &tl;iostream>
#include &tl;cctype>

using namespace std;

//Example reads in a character and tests if it punctuation
int main()
{
    char x;
    cin>>x;
    if(isspunct(x))
    {
        cout<<"Punctuation";
    }
    else
    {
        cout<<"Not punctuation.";
    }
}
Other Functions