How to determines whether a character is a letter in C++

1 Answer

0 votes
#include <iostream>

using namespace std;

int main()
{
	
	char ch = '9';
	if (isalpha(ch))
		cout << "yes" << endl;
	else
		cout << "no" << endl;

	ch = 'a';
	if (isalpha(ch))
		cout << "yes" << endl;
	else
		cout << "no" << endl;

	return 0;
}


/*
run:

no
yes

*/

 



answered Dec 5, 2016 by avibootz

Related questions

1 answer 174 views
1 answer 176 views
1 answer 158 views
1 answer 195 views
1 answer 179 views
1 answer 185 views
...