Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <ctype.h>
- #include <math.h>
- #include <string.h>
- int main()
- {
- char username[20];
- char password[10];
- int cap = 0;
- int num = 0;
- int lower = 0;
- int special = 0;
- printf("Hallo! Welcome to globzin.se \n");
- printf("\nThe password must contain a number, uppercase letter and a special character");
- printf("\nEnter your username: ");
- scanf(" %s", username);
- printf("\nEnter your password: ");
- scanf(" %s", password);
- for (const char* c = password; *c != 0; ++c)
- {
- cap |= !!isupper(*c);
- num |= !!isdigit(*c);
- lower |= !!islower(*c);
- special |= !!ispunct(*c);
- }
- if (cap && num && lower && special)
- {
- system("cls");
- printf("You made it! WHOOOOHO, cap: %d num: %d lower: %d special: %d \n\n", cap, num, lower, special);
- printf("Welcome, %s \n", username);
- }
- else
- {
- printf("You have to type in a uppercase, a number, lowercase and a special character. \n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement