Funktionen iswgraph () i C ++ kontrollerar om den givna breda karaktären har en grafisk representation eller inte.
Funktionen iswgraph () definieras i rubrikfilen.
iswgraph () prototyp
int iswgraph (wint_t ch);
Funktionen iswgraph () kontrollerar om ch har en grafisk representation som klassificeras av den aktuella C-platsen. Som standard är följande tecken grafiska:
- Siffror (0 till 9)
- Versaler (A till Z)
- Små bokstäver (a till z)
- Punktstecken (! "# $% & '() * +, -. /:;? @ () _` (|) ~)
iswgraph () Parametrar
- ch: Den breda karaktären att kontrollera.
iswgraph () Returvärde
- Funktionen iswgraph () returnerar ett värde som inte är noll om ch har ett grafiskt tecken.
- Det returnerar noll om ch inte har någon grafisk representation.
Exempel: Hur fungerar 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ör programmet blir resultatet:
har inte grafisk representation Ω har grafisk representation