C ++ iswgraph () - C ++ Standardbibliotek

Iswgraph () -funksjonen i C ++ sjekker om det gitte brede tegnet har en grafisk fremstilling eller ikke.

Funksjonen iswgraph () er definert i topptekstfilen.

iswgraph () prototype

 int iswgraph (wint_t ch);

Funksjonen iswgraph () sjekker om ch har en grafisk fremstilling som klassifisert av gjeldende C-lokalitet. Som standard er følgende tegn grafiske:

  • Sifre (0 til 9)
  • Store bokstaver (A til Å)
  • Små bokstaver (a til z)
  • Tegnsettingstegn (! "# $% & '() * +, -. /:;? @ () _` (|) ~)

iswgraph () Parametere

  • ch: Det brede tegnet å sjekke.

iswgraph () Returverdi

  • Funksjonen iswgraph () returnerer ikke null-verdi hvis ch har et grafisk representasjonstegn.
  • Den returnerer null hvis ch ikke har noen grafisk representasjon.

Eksempel: Hvordan fungerer iswgraph () -funksjonen?

 #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 kjører programmet, vil utdataene være:

 har ikke grafisk representasjon Ω har grafisk representasjon

Interessante artikler...