C ++ iswgraph () - C ++ Standardbibliothek

Die Funktion iswgraph () in C ++ prüft, ob das angegebene breite Zeichen eine grafische Darstellung hat oder nicht.

Die Funktion iswgraph () ist in der Header-Datei definiert.

iswgraph () Prototyp

 int iswgraph (wint_t ch);

Die Funktion iswgraph () prüft, ob ch eine grafische Darstellung hat, die durch das aktuelle Gebietsschema C klassifiziert ist. Standardmäßig sind die folgenden Zeichen grafisch:

  • Ziffern (0 bis 9)
  • Großbuchstaben (A bis Z)
  • Kleinbuchstaben (a bis z)
  • Interpunktionszeichen (! "# $% & '() * +, -. / :;? @ () _` (|) ~)

iswgraph () Parameter

  • ch: Das zu überprüfende breite Zeichen.

iswgraph () Rückgabewert

  • Die Funktion iswgraph () gibt einen Wert ungleich Null zurück, wenn ch ein grafisches Darstellungszeichen hat.
  • Es gibt Null zurück, wenn ch kein grafisches Darstellungszeichen hat.

Beispiel: Wie funktioniert die Funktion iswgraph ()?

 #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; )

Wenn Sie das Programm ausführen, lautet die Ausgabe wie folgt:

 hat keine grafische Darstellung Ω hat eine grafische Darstellung

Interessante Beiträge...