#include <stdio.h> #include <string.h> #include <stdlib.h> bool IsPasswordOK(void) { char Password[12]; gets(Password); return 0 == strcmp(Password, "goodpass"); } int main(void) { bool PwStatus; puts("Enter password:"); PwStatus = IsPasswordOK(); if (PwStatus == false) { puts("Access Denied"); exit(-1); } else { puts("Access Granted"); } return 0; }
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!