Advertisement
a3f

Spot the problem: Part 2

a3f
Dec 27th, 2014
519
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main(void)
  5. {
  6.     int flag = 0;
  7.     char passwd[45];
  8.     fgets(passwd, 45, stdin);
  9.     printf("Checking password... Please wait.");
  10.  
  11.     char secret_code[] = "hunter2\n";    
  12.     if(0 == strcmp(secret_code, passwd))
  13.         flag = 1;
  14.  
  15.     printf(passwd);
  16.  
  17.     if(flag) printf(" is correct :D");
  18.     else     printf(" is incorrect :(");
  19.  
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement