Die Funktion isgraph () in C ++ prüft, ob das angegebene Zeichen grafisch ist oder nicht.
isgraph () Prototyp
int isgraph (int ch);
Die isgraph()
Funktion prüft, ob ch
eine grafische Darstellung vorhanden ist, die vom aktuellen C-Gebietsschema klassifiziert wird. Standardmäßig sind die folgenden Zeichen grafisch:
- Ziffern (0 bis 9)
- Großbuchstaben (A bis Z)
- Kleinbuchstaben (a bis z)
- Interpunktionszeichen (! "# $% & '() * +, -. / :;? @ () _` (|) ~)
Das Verhalten von isgraph()
ist undefiniert, wenn der Wert von ch nicht als vorzeichenloses Zeichen dargestellt werden kann oder nicht gleich EOF ist.
Es ist in der Header-Datei "> Header-Datei definiert.
isgraph () Parameter
ch
: Das zu überprüfende Zeichen.
isgraph () Rückgabewert
Die Funktion isgraph () gibt einen Wert ungleich Null zurück, wenn ch grafisch ist, andernfalls gibt sie Null zurück.
Beispiel: Funktionsweise der Funktion isgraph ()
#include #include using namespace std; int main() ( char ch1 = '$'; char ch2 = ' '; isgraph(ch1)? cout << ch1 << " has graphical representation" : cout << ch1 << " does not have graphical representation"; cout << endl; isgraph(ch2)? cout << ch2 << " has graphical representation" : cout << ch2 << " does not have graphical representation"; return 0; )
Wenn Sie das Programm ausführen, lautet die Ausgabe wie folgt:
$ hat eine grafische Darstellung hat keine grafische Darstellung