isgraph()Prototype: int isgraph(int Char);Header File: ctype.h (C) or cctype (C++) Explanation: Checks whether the character is printable, and returns true if it is with the exception of the space, which it will return false for. Example:
//Example inputs a character
//Example checks if character can be printed
#include <cctype>
#include <iostream>
using namespace std;
int main()
{
char x;
cout<<"Enter any character: ";
cin>>x;
if(isgraph(x)
{
cout<<x;
}
else
{
cout<<"Sorry, could not print character";
}
}
Other Functions
|