#include <stdio.h>
main()
{
char name[30];
int age;
printf("Please enter your name: ");
scanf("%s", name);
printf("How old are you %s: ", name);
scanf("%d", age);
if (strcmp(name, "Abs") == 1 && age == 25)
printf("You are the CHOSEN one!\n");
else
printf("You are a wankstain!\n");
fflush(stdin);
getchar();
}
if语句似乎忽略了正确的答案,我也试图将年龄放在括号中无济于事。
答案 0 :(得分:1)
strcmp
的手册页。你去检查零。scanf
- 它确实返回了需要检查的值。stdin
。(请参阅http://linux.die.net/man/3/strcmp和http://linux.die.net/man/3/scanf)