C ++ isdigit () - Biblioteca padrão C ++

A função isdigit () em C ++ verifica se o caractere fornecido é um dígito ou não.

Protótipo isdigit ()

 int isdigit (int ch);

A isdigit()função verifica se ch é um dígito ou não, ou seja, 0,1,2,3,4,5,6,7,8 e 9.

O comportamento de isdigit()é indefinido se o valor de ch não for representável como unsigned char ou não for igual a EOF.

É definido no arquivo de cabeçalho "> arquivo de cabeçalho.

Parâmetros isdigit ()

ch: O personagem a ser verificado.

isdigit () Valor de retorno

A isdigit()função retorna um valor diferente de zero se ch for um dígito, caso contrário, retorna zero.

Exemplo: como funciona a função 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

Artigos interessantes...