题解 | #判断是不是字母#
判断是不是字母
http://www.nowcoder.com/practice/91a588dd4cd244bfa616f17603ec123c
// 换换思路,试试 break 和 continue 跳出循环
#include<iostream>#include<math.h>
using namespace std;
int main()
{
char a, x, y;
while (cin >> a) {
for (x = 'A',y = 'a'; x <= 'Z', y <= 'z'; x++, y++)
if (a == x || a == y)
{
cout << a << " is an alphabet." << endl;
break;
}
if (x <= 'Z')
continue;
cout << a << " is not an alphabet." << endl;
}
system("pause");
return 0;
}