English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

C / C ++in the iswpunct() function

The functioniswpunct()is used to check if the passed wide character is a punctuation symbol. If it is not a punctuation symbol, it returns zero, otherwise it returns a non-zero value. Declared in the "cwctype" header file.

This iswpunct()

int iswpunct(wint_t character);

This is an example iswpunct()

Example

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

Output results

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

In the above program, two wide characters are declared as a and b. It checks whether the character is a punctuation symbol.

wint_t a = '!';
wint_t b = 'a';
if(iswpunct(a))
printf("Character is a punctuation.");
else
printf("\nThe character is not a punctuation.");
if(iswpunct(b))
printf("\nCharacter is a punctuation.");
else
printf("\nThe character is not a punctuation.");