Home > Backend Development > C++ > 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.

王林
Release: 2023-09-01 16:09:07
forward
1079 people have browsed it

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);
Copy after login

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;
}
Copy after login

Output

The character is a punctuation.
The character is not a punctuation.
Copy after login

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.");
Copy after login

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!

Related labels:
source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template