Ctype.h – isxdigit()














































Ctype.h – isxdigit()



Ctype.h – isxdigit()

 

The C++ isxdigit() function determines whether the provided character is hexadecimal or not. In the header file ctype.h, the isxdigit() function is defined.

 

SYNTAX

Following is the syntax of isxdigit() function:-

 

char isxdigit( char x);

 

PARAMETER

It takes any valid character x as an input to the function.

 

OUTPUT

It return true if the passes character is a hexadecimal digit and false otherwise.

 

CODE

// use of isxdigit in C++

#include <iostream>

#include <string>

#include <ctype.h>

 

using namespace std;

 

int main()

{

    string s = "AaBbCxXxYyZz";

    int n = s.size();

    for(int i=0;i<n;i++)

    {

        if(isxdigit(s[i]))

            cout<<s[i]<< " is a Hexadecimal character"<<endl;

        else

            cout<<s[i]<<" is NOT a Hexadecimal character"<<endl;

    }

    return 0;

}

 

OUTPUT


 


Comments