Advertisement
Guest User

Untitled

a guest
Jun 5th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. // Liam Skirrow
  2. // This program will ask for a username and password, and will allow access if
  3. // the user inputs the correct combination of the two.
  4.  
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7.  
  8.  
  9. int main(int argc, char * argv[]) {
  10.  
  11. int username;
  12. int password;
  13.  
  14. printf ("Please enter your username.\n");
  15. while (2 > 1) {
  16. scanf ("%d", &username);
  17. if (username == 0) {
  18. printf ("Welcome Liam! Now please enter your password.\n");
  19. break;
  20. } else {
  21. printf ("Unrecognised username, please try again.\n");
  22. }
  23.  
  24. }
  25.  
  26. while (2 > 1) {
  27. scanf ("%d", &password);
  28. if (password == 1) {
  29. printf ("Access Granted\n");
  30. break;
  31. } if (password != 1) {
  32. printf ("Access Denied. Please try again.\n");
  33. }
  34. }
  35.  
  36. return EXIT_SUCCESS;
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement