De functie iswgraph () in C ++ controleert of het gegeven brede teken een grafische weergave heeft of niet.
De functie iswgraph () is gedefinieerd in het header-bestand.
iswgraph () prototype
int iswgraph (wint_t ch);
De functie iswgraph () controleert of ch een grafische weergave heeft zoals geclassificeerd door de huidige C-locale. Standaard zijn de volgende tekens grafisch:
- Cijfers (0 t / m 9)
- Hoofdletters (A tot Z)
- Kleine letters (a tot z)
- Leestekens (! "# $% & '() * +, -. /:;? @ () _` (|) ~)
iswgraph () Parameters
- ch: het brede teken dat moet worden gecontroleerd.
iswgraph () Retourwaarde
- De functie iswgraph () retourneert een waarde die niet nul is als ch een grafisch representatieteken heeft.
- Het geeft nul terug als ch geen grafisch representatiekarakter heeft.
Voorbeeld: hoe werkt de functie 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; )
Wanneer u het programma uitvoert, is de uitvoer:
heeft geen grafische weergave Ω heeft geen grafische weergave