SHARE
TWEET

Untitled

a guest Dec 7th, 2017 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. char *  itoa ( int value, char * str )
  6. {
  7.  
  8.     int i =0;
  9.     while (value > 0) {
  10.         int digito = value % 10;
  11.  
  12.         str[i] = digito + '0';
  13.         value /= 10;
  14.         i++;
  15.  
  16.     }
  17.     int ic=0;
  18.     for(int a =i-1; a>=0; a--){
  19.         str[ic] = str[a];
  20.         ic++;
  21.     }
  22.     return str;
  23.  
  24.  
  25. }
  26.  
  27. int main()
  28. {
  29.    char login[6]={0};
  30.  
  31.    int passwd;
  32.    char senha[6]={0};
  33.  
  34.    char logins[6]="Teste";
  35.    char senhas[6]="12345";
  36.  
  37.   do{
  38.      printf("\n\tDigite o Login: ");
  39.      scanf("%s",login);
  40.  
  41.      if((strcmp(login, logins) == 0))break;
  42.      else
  43.      printf("\tUsuario: %s Inválido..!!\n", login);
  44.  
  45.      }while((strcmp(login, logins) != 0));
  46.  
  47.   do{
  48.      printf("\n\tDigite sua senha: ");
  49.      scanf("%d",passwd);
  50.  
  51.      //sprintf(senha,"%s",passwd);
  52.      //snprintf(senha, 6, "%d", passwd);
  53.       itoa(passwd,senha);
  54.  
  55.      if((strcmp(senha, senhas) == 0))
  56.      printf("\n\tUsuario e Senha Válidos\n\tAcesso autorizado..!!!\n\n");
  57.        else
  58.      printf("\tSenha: %s Inválida..!!\n", senha);
  59.  
  60.     }while((strcmp(senha, senhas) != 0));
  61.  
  62.    return 0;
  63. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top