Jkljk

MODULARIZAÇÃO - autenticador.c (onde ficam as funções utilizadas pelo autenticador.h - recebe uma senha e verifica ela)

Sep 14th, 2020 (edited)
691
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.82 KB | None | 0 0
  1. #include "autenticador.h"
  2.  
  3. int ValidaSenha(char senha[tam]){
  4.  
  5.     char a = ' ', b = ' ', c = ' ';
  6.     int result = 0, i;
  7.     for(int i=0; i<strlen(senha); i++)
  8.     {
  9.         //verifica se tem uma letra maiuscula, minuscula ou um numero na senha
  10.         if(senha[i]>='a' && senha[i]<='z')
  11.         {
  12.             a=senha[i];
  13.         }
  14.         if(senha[i]>='A' && senha[i]<='Z')
  15.         {
  16.             b=senha[i];
  17.         }
  18.         if(senha[i]>='0' && senha[i]<='9')
  19.         {
  20.             c=senha[i];
  21.         }
  22.     }
  23.  
  24.     if(a != ' ')
  25.     {
  26.         if(b != ' ')
  27.         {
  28.             if(c != ' ')
  29.             {
  30.                 //retorna 1 caso a senha tenha ao menos 1 numero, uma letra maiuscula e uma minuscula
  31.                 return 1;
  32.             }
  33.         }
  34.     }
  35.     else
  36.     {
  37.         return 0;
  38.     }
  39. }
Add Comment
Please, Sign In to add comment