iswctype() in C++

int iswctype(wint_t c, wctype_t desc)

iswctype(): This function is available in the file ctype.h. This function checks if the wide character has property specified by desc. Some of strings passed to desc are "alnum", "alpha", "digit", etc. This function returns a value different from zero (i.e. true) if indeed c has the property identified by desc. Zero (i.e. false) otherwise.

Parameters: Two parameters are required for this function.

1. c: Wide character to be checked, cast to a wint_t, or WEOF. wint_t is an integral type. 

2. desc: A value returned by a call to wctype (with the same LC_CTYPE locale category selected as in this call). wctype_t is the scalar type used as the return type for wctype.

Syntax:

iswctype(c,desc)

For Example:

iswctype(L'p', wctype("alpha")) = > It return true.

Approach

C++

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

int main()
{
    wchar_t C = L'p';

    cout << iswctype(Cwctype("alpha")) << "\n";

    return 0;
}


No comments:

Post a Comment