C ++ isgraph () - C ++ standaardbibliotheek

De functie isgraph () in C ++ controleert of het gegeven teken grafisch is of niet.

isgraph () Prototype

 int isgraph (int ch);

De isgraph()functie controleert of cher een grafische weergave is 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 (! "# $% & '() * +, -. /:;? @ () _` (|) ~)

Het gedrag van isgraph()is niet gedefinieerd als de waarde van ch niet kan worden weergegeven als unsigned char of niet gelijk is aan EOF.

Het wordt gedefinieerd in header-bestand "> header-bestand.

isgraph () Parameters

ch: Het personage om te controleren.

isgraph () Retourwaarde

De functie isgraph () retourneert een waarde die niet nul is als ch grafisch is, en anders nul.

Voorbeeld: hoe de functie isgraph () werkt

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

Wanneer u het programma uitvoert, is de uitvoer:

 $ heeft een grafische weergave heeft geen grafische weergave

Interessante artikelen...