#include <stdio.h>
#include <string.h>
int main()
{
int i;
char candi[20] = {0};
int is_lower = 0;
int is_upper = 0;
int is_digit = 0;
int is_special = 0;
while(1){
printf("Make a password : ");
scanf("%s", candi);
for(i = 0; i < strlen(candi); i++){
if((candi[i]>='a')&&(candi[i]<='z'))
is_lower += 1;
if((candi[i]>='A')&&(candi[i]<='Z'))
is_upper += 1;
if((candi[i]>='0')&&(candi[i]<='9'))
is_digit += 1;
if((candi[i]>='!')&&(candi[i]<='/'))
is_special += 1;
}
if((is_lower >= 1)&&(is_upper >= 1)&&(is_digit >= 1)){
printf("Enough password");
return 0;
}
else if ((is_lower >= 1)&&(is_upper >= 1)&&(is_digit >= 1)&&(is_special >= 1)){
printf("Strong password");
return 0;
}
else{
printf("Make password again with lower , upper case and digit.\n");
}
}
return 0;
}
//it has been so long time to post (actually coding itself^^) coding practice!!
I visited France for 6 week and it was so lovely vacation, but not easy to code hahaha.
I have no idea how to check if there were special charactors...
gatta join some coding community to find any help
Chao!
#include <string.h>
int main()
{
int i;
char candi[20] = {0};
int is_lower = 0;
int is_upper = 0;
int is_digit = 0;
int is_special = 0;
while(1){
printf("Make a password : ");
scanf("%s", candi);
for(i = 0; i < strlen(candi); i++){
if((candi[i]>='a')&&(candi[i]<='z'))
is_lower += 1;
if((candi[i]>='A')&&(candi[i]<='Z'))
is_upper += 1;
if((candi[i]>='0')&&(candi[i]<='9'))
is_digit += 1;
if((candi[i]>='!')&&(candi[i]<='/'))
is_special += 1;
}
if((is_lower >= 1)&&(is_upper >= 1)&&(is_digit >= 1)){
printf("Enough password");
return 0;
}
else if ((is_lower >= 1)&&(is_upper >= 1)&&(is_digit >= 1)&&(is_special >= 1)){
printf("Strong password");
return 0;
}
else{
printf("Make password again with lower , upper case and digit.\n");
}
}
return 0;
}
//it has been so long time to post (actually coding itself^^) coding practice!!
I visited France for 6 week and it was so lovely vacation, but not easy to code hahaha.
I have no idea how to check if there were special charactors...
gatta join some coding community to find any help
Chao!
댓글
댓글 쓰기