Funksjonen iswpunct () i C ++ sjekker om det gitte brede tegnet er tegnsetting eller ikke.
Funksjonen iswpunct () er definert i topptekstfilen.
iswpunct () prototype
int iswpunct (wint_t ch);
Funksjonen iswpunct () sjekker om ch er et tegnsettingstegn eller ikke. Som standard er tegnsettingstegnene
! "# $% & '() * +, -. /:;? @ () _` (|) ~.
iswpunct () -parametere
- ch: Det brede tegnet å sjekke.
iswpunct () Returverdi
- Funksjonen iswpunct () returnerer ikke null-verdi hvis ch er et tegnsettingstegn.
- Den returnerer null hvis ch ikke er et tegnsettingstegn.
Eksempel: Hvordan fungerer wpunct () -funksjonen?
#include #include #include using namespace std; int main() ( setlocale(LC_ALL, "en_US.UTF-8"); wchar_t ch1 = L'u0938'; wchar_t ch2 = L'u007e'; iswpunct(ch1) ? wcout << ch1 << L" is a punctuation character" : wcout << ch1 << L" is not a punctuation character"; wcout << endl; iswpunct(ch2) ? wcout << ch2 << L" is a punctuation character" : wcout << ch2 << L" is not a punctuation character"; return 0; )
Når du kjører programmet, vil utdataene være:
स er ikke et tegnsettingstegn ~ er et tegnsettingstegn