My Solution

0 Derek Dawson · September 7, 2014
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <math.h>


main() {

    int checks[3];
    for(int i = 0; i < 3; i++) {
        checks = 0;
    }

    printf("enter you password: ");
    char password[20];
    scanf("%s", password);

    for(int i = 0; i < 20; i++) {
        char c = password;
        if(c == '\0') {
            break;
        } else if(isupper(c)) {
            checks[0] = 1;
        } else if(c == '$') {
            checks[1] = 1;
        } else if(isdigit(c)) {
            checks[2] = 1;
        }
    }

    if(checks[0] != 1)
        printf("you need an upper case letter\n");
    if(checks[1] != 1)
        printf("you need a $ sign\n");
    if(checks[2] != 1)
        printf("you need a number\n");
    if(checks[0] == 1 && checks[1] == 1 && checks[2] == 1) {
        printf("your password is hella boss like bucky\n");
    }
}

Post a Reply

Replies

Oldest  Newest  Rating
0 Giorgi Aptsiauri · September 8, 2014
doesn't compile
  • 1

C

107,131 followers
About

One of the most popular languages of all time.

Links
Moderators
Bucky Roberts Administrator