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 179 views
1 answer 181 views
1 answer 162 views
1 answer 200 views
1 answer 185 views
1 answer 189 views
...