moth/games/compaq/passwd/main.c

29 lines
452 B
C
Raw Normal View History

2009-09-03 12:07:10 -06:00
#include <stdio.h>
#include <string.h>
int
main(int argc, char *argv[])
{
char reply[256];
printf("What is the password? ");
fflush(stdout);
if (fgets(reply, sizeof(reply), stdin)) {
char *p;
for (p = reply; *p; p += 1) {
if ('\n' == *p) {
*p = '\0';
break;
}
}
if (strcmp(reply, passwd)) {
printf("No it isn't!\n");
} else {
printf("Congratulations.\n");
}
}
return 0;
}