iscntrl() in C++

iscntrl(): This function is available in the file ctype.h. This function checks whether a character is a control character or not. A control character is a character that does not occupy a printing position on the display.

Parameters: One parameter is required for this function.

arg: Character to be checked.

Syntax:

iscntrl(arg)

Approach

C++

#include <bits/stdc++.h>
using namespace std;

int main()
{

    char ch[] = "Hello world \n Ram";

    for (int i = 0; !iscntrl(ch[i]); i++)
    {
        cout << ch[i];
    }

    return 0;
}

Output:

Hello world 


isblank() in C++

isblank(): This function is available in the file ctype.h. This function checks whether a character is a blank character or not. A space character is known as a blank character. If a character is a blank character (' ') then it returns a value different from zero (i.e true). Otherwise, it returns false(0).

Parameters: One parameter is required for this function.

arg: The character to be checked.

Syntax:

isblank(arg)

For Example:

isblank(' ') = > It returns true (any non zero value).

Approach

C++

#include <bits/stdc++.h>
using namespace std;

int main()
{

    char ch = ' ';

    cout << isblank(ch<< "\n";

    return 0;
}


isalpha() in C++

isalpha(): This function is available in the file ctype.h. This function checks if the character is an alphabetic character. All English letters are considered alphabets. This function returns the Non-zero value if the character is an alphabetic character, zero otherwise.

Parameters: One parameter is required for this function.

arg: The character to check for alphabets.

Syntax:

isalpha(arg)

For Example:

isalpha('a') = > It returns true.

Approach

C++

#include <bits/stdc++.h>
using namespace std;

int main()
{
    char ch = 'a';

    cout << isalpha(ch<< "\n";

    return 0;
}


isalnum() in C++

isalnum(): This function is available in the file ctype.h. This function is used to check the character is alphanumeric or not. Check whether a character is either a decimal digit or letter.This function returns a value different from zero (i.e. true) if indeed c is either a digit or a letter. Zero (i.e. false) otherwise.

Parameters: One parameter is required for this function.

arg: The character to check for alphanumeric (alphabet+number).

Syntax:

isalnum(arg):

For Example:

1.isalnum('1') = > It return true.

2.isalnum('a') = > It returns true.

3.isalnum('-') = > It returns false.

Approach

C++

#include <bits/stdc++.h>
using namespace std;

int main()
{
    char C = '1';
    cout << isalnum(C<< "\n";
    
    return 0;
}