C ++ isdigit () - C ++ standaardbibliotheek

De functie isdigit () in C ++ controleert of het gegeven teken een cijfer is of niet.

isdigit () Prototype

 int isdigit (int ch);

De isdigit()functie controleert of ch een cijfer is of niet, dwz een van 0,1,2,3,4,5,6,7,8 en 9.

Het gedrag van isdigit()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.

isdigit () Parameters

ch: het teken dat moet worden gecontroleerd.

isdigit () Retourwaarde

De isdigit()functie retourneert een waarde die niet nul is als ch een cijfer is, anders nul.

Voorbeeld: hoe de functie isdigit () werkt

 #include #include #include using namespace std; int main() ( char str() = "hj;pq910js4"; cout << "The digit in the string are:" << endl; for (int i=0; i 

When you run the program, the output will be:

 The digit in the string are: 9 1 0 4

Interessante artikelen...