Funktionen iswgraph () i C ++ kontrollerer, om det givne brede tegn har en grafisk repræsentation eller ej.
Funktionen iswgraph () er defineret i headerfilen.
iswgraph () prototype
int iswgraph (wint_t ch);
Funktionen iswgraph () kontrollerer, om ch har en grafisk repræsentation, der er klassificeret efter den aktuelle C-lokalitet. Som standard er følgende tegn grafiske:
- Cifre (0 til 9)
- Store bogstaver (A til Z)
- Små bogstaver (a til z)
- Tegnsætningstegn (! "# $% & '() * +, -. /:;? @ () _` (|) ~)
iswgraph () Parametre
- ch: Den brede karakter, der skal kontrolleres.
iswgraph () Returværdi
- Funktionen iswgraph () returnerer værdi, der ikke er nul, hvis ch har et grafisk repræsentationstegn.
- Det returnerer nul, hvis ch ikke har nogen grafisk repræsentation.
Eksempel: Hvordan fungerer iswgraph () -funktionen?
#include #include #include using namespace std; int main() ( setlocale(LC_ALL, "en_US.UTF-8"); wchar_t ch1 = L'u0009'; wchar_t ch2 = L'u03a9'; iswgraph(ch1)? wcout << ch1 << L" has graphical representation" : wcout << ch1 << L" does not have graphical representation"; wcout << endl; iswgraph(ch2)? wcout << ch2 << L" has graphical representation" : wcout << ch2 << L" does not have graphical representation"; return 0; )
Når du kører programmet, vil output være:
har ikke grafisk repræsentation Ω har grafisk repræsentation