运用alpha函数可以方便判断输入的字符类型是否为字母,头文件(#include<ctype.h>)
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<ctype.h>
using namespace std ;
int main() {
char s[] = "C++" ;
for( int i = 0 ; i < strlen(s) ; i++ )
if(isalpha(s[i]))
cout << "yes" << endl ;
else
cout << "no" << endl ;
return 0 ;
}