c++ check if char is number
char c = '1';
bool result = isdigit(c);
cout << result << endl; //1
c++ check if char is number
char c = '1';
bool result = isdigit(c);
cout << result << endl; //1
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;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us