De functie isprint () in C ++ controleert of het gegeven teken afdrukbaar is of niet.
isprint () Prototype
int isprint (int ch);
De isprint()
functie controleert of ch kan worden afgedrukt zoals geclassificeerd door de huidige C-locale. Standaard kunnen de volgende tekens worden afgedrukt:
- Cijfers (0 t / m 9)
- Hoofdletters (A tot Z)
- Kleine letters (a tot z)
- Leestekens (! "# $% & '() * +, -. /:;? @ () _` (|) ~)
- Ruimte
Het gedrag van isprint()
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.
isprint () Parameters
ch: het teken dat moet worden gecontroleerd.
isprint () Retourwaarde
De isprint()
functie retourneert een waarde die niet nul is als ch kan worden afgedrukt, en anders nul.
Voorbeeld: hoe de functie isprint () werkt
#include #include #include using namespace std; int main() ( char str() = "Hello allhow are you"; for (int i=0; i
When you run the program, the output will be:
Hello all how are you