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()
#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("\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; }
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 = '!'; wint_t b = 'a'; 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!