Funksjonen isgraph () i C ++ sjekker om det gitte tegnet er grafisk eller ikke.
isgraph () Prototype
int isgraph (int ch);
De isgraph()
funksjons kontrollerer om ch
har en grafisk representasjon som klassifisert av den aktuelle lokalitet C. Som standard er følgende tegn grafiske:
- Sifre (0 til 9)
- Store bokstaver (A til Å)
- Små bokstaver (a til z)
- Tegnsettingstegn (! "# $% & '() * +, -. /:;? @ () _` (|) ~)
Oppførselen til isgraph()
er udefinert hvis verdien av ch ikke kan representeres som usignert røye eller ikke er lik EOF.
Den er definert i topptekstfil "> topptekstfil.
isgraph () Parametere
ch
: Tegnet å sjekke.
isgraph () Returverdi
Funksjonen isgraph () returnerer ikke null-verdi hvis ch er grafisk, ellers returnerer null.
Eksempel: Hvordan isgraph () fungerer
#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; )
Når du kjører programmet, vil utdataene være:
$ har grafisk representasjon har ikke grafisk representasjon