我知道" if(isalpha(first))"但我不知道如何解决它。谁能告诉我为什么这是错的?
//
#include <iostream>
#include <ctype.h>
#include <string.h>
using namespace std;
int main()
{
char first[80];
cout << "\nWhat is your first name? ";
cin >> first;
if (isalpha(first))
cout << "\nNice Job, " << first << '\n';
else
cout << "\nThat is not a name!\n";
return 0;
}
答案 0 :(得分:2)
if (isalpha(first))
isalpha()
接受int
作为参数,但您提供了char[]
。