Answers for "isdigit c++"

C++
0

isdigit c++

int isdigit ( int c );
Checks whether c is a decimal digit character.
  
A value different from zero (i.e., true)
if indeed c is a decimal digit. Zero (i.e., false) otherwise.


/* isdigit example */
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
int main ()
{
  char str[]="1776ad";
  int year;
  if (isdigit(str[0]))
  {
    year = atoi (str);
    printf ("The year that followed %d was %d.\n",year,year+1);
  }
  return 0;
}  

/* Output */
The year that followed 1776 was 1777
Posted by: Guest on May-12-2021
0

isdigit c++

str = "10"
  
//Evaluates to True
isdigit(str[0])
Posted by: Guest on December-26-2020
0

check if character in string is digit c++

#include<stdio.h>
#include<ctype.h>

int main() {
   char val1 = 's';
   char val2 = '8';

   if(isdigit(val1))
   printf("The character is a digit\n");
   else
   printf("The character is not a digit\n");

   if(isdigit(val2))
   printf("The character is a digit\n");
   else
   printf("The character is not a digit");

   return 0;
}
Posted by: Guest on September-14-2020

Browse Popular Code Answers by Language