iswpunct() function in C/C++

CC++Server Side Programming

The function iswpunct() is used to check that the passing wide character is a punctuation or not. It returns zero, if it is not a punctuation, otherwise it returns a non-zero value. It is declared in “cwctype” header file.

Here is the syntax of iswpunct()

int iswpunct(wint_t character);

Here is an example of iswpunct()

Example

#include<cwctype>
#include<stdio.h>
using namespace std;
int main() {
   wint_t a = '!';
   wint_t b = 'a';
   if(iswpunct(a))
   printf("The character is a punctuation.");
   else
   printf("
The character is not a punctuation.");    if(iswpunct(b))    printf("
The character is a punctuation.");    else    printf("
The character is not a punctuation.");    return 0; }

Output

The character is a punctuation.
The character is not a punctuation.

In the above program, two wide characters are declared as a and b. The characters are checked that passed character is a punctuation or not.

wint_t a = '!';
wint_t b = 'a';
if(iswpunct(a))
printf("The character is a punctuation.");
else
printf("
The character is not a punctuation."); if(iswpunct(b)) printf("
The character is a punctuation."); else printf("
The character is not a punctuation.");
raja
Updated on 26-Jun-2020 07:53:21

Advertisements