Funkce isdigit () v C ++ kontroluje, zda je daný znak číslice nebo ne.
isdigit () prototyp
int isdigit (int ch);
Tyto isdigit()
funkce kontroluje, zda ch je číslice, nebo ne, tj jeden z 0,1,2,3,4,5,6,7,8 a 9.
Chování isdigit()
je nedefinováno, pokud hodnota ch není reprezentovatelná jako nepodepsaný znak nebo se nerovná EOF.
Je definován v hlavičkovém souboru.
isdigit () parametry
ch: Znak ke kontrole.
isdigit () Návratová hodnota
isdigit()
Funkce vrací nenulovou hodnotu, pokud ch je číslice, jinak vrátí nulu.
Příklad: Jak funguje funkce isdigit ()
#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