#includeusingnamespacestd;intmain(){ wint_ta='!&am"/> #includeusingnamespacestd;intmain(){ wint_ta='!&am">

Home  >  Article  >  Backend Development  >  In C/C++, the function of iswpunct() function is to determine whether a wide character is a punctuation mark.

In C/C++, the function of iswpunct() function is to determine whether a wide character is a punctuation mark.

王林
王林forward
2023-09-01 16:09:071041browse

In C/C++, the function of iswpunct() function is to determine whether a wide character is a punctuation mark.

The function iswpunct() is used to check whether the passed wide character is a punctuation mark. If it is not a punctuation mark, zero is returned, otherwise a non-zero value is returned. It is declared in the "cwctype" header file.

The following is the syntax of iswpunct():

int iswpunct(wint_t character);

This is an example of iswpunct()

Example

#include<cwctype>
#include<stdio.h>
using namespace std;
int main() {
   wint_t a = &#39;!&#39;;
   wint_t b = &#39;a&#39;;
   if(iswpunct(a))
   printf("The character is a punctuation.");
   else
   printf("\nThe character is not a punctuation.");
   if(iswpunct(b))
   printf("\nThe character is a punctuation.");
   else
   printf("\nThe 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. Checks whether the passed characters are punctuation marks.

wint_t a = &#39;!&#39;;
wint_t b = &#39;a&#39;;
if(iswpunct(a))
printf("The character is a punctuation.");
else
printf("\nThe character is not a punctuation.");
if(iswpunct(b))
printf("\nThe character is a punctuation.");
else
printf("\nThe character is not a punctuation.");

The above is the detailed content of In C/C++, the function of iswpunct() function is to determine whether a wide character is a punctuation mark.. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete