Answers for "string c++ if letter or number"

C++
4

string c++ if letter or number

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

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

   if(isalpha(val1))
   printf("The character is an alphabet\n");
   else
   printf("The character is not an alphabet\n");

   if(isalpha(val2))
   printf("The character is an alphabet\n");
   else
   printf("The character is not an alphabet");

   return 0;
}
Posted by: Guest on September-14-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
1

string c++ if letter or number

char test='a';
cout<<isalpha(test);
Posted by: Guest on August-20-2020

Code answers related to "string c++ if letter or number"

Browse Popular Code Answers by Language