Can someone help me to fix this code (Challenge #1)

+2 Minh Quan Vu · November 15, 2014
#include <stdio.h>
#include <stdlib.h>

int main()
{
    char password[20];
    int i, upper = 0, digit = 0, dolarsign = 0;

    printf("Enter your password. This program will check it is strong or not \n");
    scanf("%s", password);

    for(i = 0; i <= 20; i++){
        if( isalpha(password) ){
                if( isupper(password) ){
                    upper++;
                }
            }
        if( isdigit(password) ){
            digit++;
        }else{
            dolarsign++;
        }
        if(upper>=1 && digit>=1 &&dolarsign>=1){
            printf("Your password is strong!\n");
        }else{
            printf("Your password is not strong enough!\n");
        }
    }


return 0;
}



Post a Reply

Replies

Oldest  Newest  Rating
0 Minh Quan Vu · November 17, 2014
I dont know why it shows "your password is not strong enough" for many times, I just need it shows one time. Can you help me to fix this issue ?
0 Minh Quan Vu · November 17, 2014
I looked at your code but as you can see in the output it showed "Your password is strong" for 5 times then after that is "Your password is not strong" 
0 Minh Quan Vu · November 18, 2014
Thank you guys. My code is working now :D
-1 Minh Quan Vu · November 16, 2014
It doesn't work. Whatever my password is, it just shows "your password is not strong" for several times
  • 1

C

126,582 followers
About

One of the most popular languages of all time.

Links
Moderators
Bucky Roberts Administrator