#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <string.h>
int main() {
char userPassword[20];
printf("Type in your password: \n");
scanf("%c", &userPassword);
if (isalpha(userPassword) == 0) {
printf("Nice");
} else {
printf("Nope");
}
return 0;
}
我试图想出一个代码来检查密码是否只包含字母。为什么此代码仅适用于“== 0”符号。我的朋友告诉我把这个和我的代码工作。“== 0”有什么作用?