Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. void main ()
  5. {
  6. char pswrd[20];
  7. char rep[2];
  8. char *resp = "y";
  9. int a = 0;
  10.  
  11. again:
  12. printf("Enter your password:\n");
  13. scanf("%s", &pswrd);
  14. printf("%s\n", pswrd);
  15.  
  16. if (strcmp(pswrd,"bscs1b") == 0)
  17. {
  18. printf("Access granted\n\n");
  19. }
  20. else
  21. {
  22. printf("Try again? (y/n)\n");
  23. scanf("%s", &rep);
  24. if (strcmp(rep, resp) == 0)
  25. {
  26. a++;
  27. if (a < 4)
  28. {
  29. goto again;
  30. }
  31. else
  32. {
  33. printf("You can't try again...\n");
  34. }
  35. }
  36. else
  37. {
  38. printf("Bye...\n");
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement