Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Liam Skirrow
- // This program will ask for a username and password, and will allow access if
- // the user inputs the correct combination of the two.
- #include <stdio.h>
- #include <stdlib.h>
- int main(int argc, char * argv[]) {
- int username;
- int password;
- printf ("Please enter your username.\n");
- while (2 > 1) {
- scanf ("%d", &username);
- if (username == 0) {
- printf ("Welcome Liam! Now please enter your password.\n");
- break;
- } else {
- printf ("Unrecognised username, please try again.\n");
- }
- }
- while (2 > 1) {
- scanf ("%d", &password);
- if (password == 1) {
- printf ("Access Granted\n");
- break;
- } if (password != 1) {
- printf ("Access Denied. Please try again.\n");
- }
- }
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement