From f7855a920e7f58a1fee47fc26864fdb981e5e6b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Paulo=20S=C3=A3o=20Pedro?= Date: Fri, 28 May 2021 19:12:54 +0100 Subject: [PATCH] v2 update --- a.out | Bin 22136 -> 17088 bytes main.c | 9 +++- teste2copy.c => teste2.1.c | 0 teste6.c | 100 +++++++++++++++++++++++++++++++++++++ 4 files changed, 107 insertions(+), 2 deletions(-) rename teste2copy.c => teste2.1.c (100%) create mode 100644 teste6.c diff --git a/a.out b/a.out index bcacda0d42086c2bec3ae4d3926113bd38f0d0ae..bbe8f6818b6ab2031ab7893ab05c66030fce1fb7 100755 GIT binary patch literal 17088 zcmeHOeQX@X6`%9jiGk$oKvGPgWJ8JS(E4)DcPK7*jxSjw2MokO1z|b+*7g!=|} zOj%wmPm^LHJhWN0kEzp+T;^JAyIh-_PAa>@in1NCWH+hoCY2r2GgKiYrW{X-30+%N zJiSzdjFKjQh49+lr0l%3L+LZ6GALdDvK9Y#%Ij8k4{Fkl@X{_D7EHOkYhkClNNN0Y z!rgqGDz8#M}bpA*3B)OHwH7Q;Cfjw)r-oYF}3sR z9sxJggsCvfzF4k!lHYSz_~tuKbgj?cchA%B=Ju_8>S_o5C=%#Yoo50L)mizT1ty!P|}gSYk+Itau_RM$(C-)i3%7Oz32+^pKe(g8#7S z8;u$LiDYajafb<(iXks)%NUNqc4t>-`*ve}a7!__v6x#Q+$4<7-MfsqnKlO!8Ou!X z-nD%wl{9z9dWXo{z;G(5ycxD?Sw-2@8jLwVF8W7v3jH!ix90NMLx@icy6v zm%LwmPVw25iL=Q55O_*F4{|&;)hP$nJjeKH_4lVfEX|7Z74xUAv~jv8s6L!dJ8;VT(^8lwQ2QL3! zDZwKSoXX%d?Z6S}Vmjf#&n}`uoOIwz9C$TbjX*U5)d*B0P>nz}0{=e|c&p*!zv^SJ z)$8MRFRT+nKQL|86i(`6PuA0uv=D_&y@2NmYx+PMRteG{B*EP5?+S&&q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N-YBb61u+LtS+&aFVg1Ie(4uOUHaLW*DQ-xaKu#H#*^ zPQe?IPiIUjt@il}s^yNo{;Cd1M98L!U!4aiI4B8K`F8!kBl(v}I(2TKpgMOWezKXJ z|6bt8CQ3e*6e37y-wE5>{~jB^CixVsvl-kbo;_gW-yqK=6jb!GR`%+#hi&}oTth+Y zGeVM~3KXP(r)?_Dg=%{%T#W;Kgd= zD*09WDY3t?@vCze1s_p_657lEgNi9e;c8h 12 || dia > 31) { + + return 0; + } + if ((mes == 4 || mes == 6 || mes == 9 || mes == 11) && (dia > 30)) { return 0; @@ -398,10 +403,10 @@ void listarPerfil(Perfil *p, int counter){ int i; - printf("\t\t--------------------------- [Perfis existentes] ---------------------------\n\n"); + printf("\n\t\t------------------- [Escolha um perfil para fazer login] -------------------\n\n"); for(i=0; i < counter; i++) { - printf("\t\t-> %s %s de %s\n", p[i].nome,p[i].sobrenome, p[i].localidade); + printf("\t\t(%d) %s %s de %s\n", i, p[i].nome,p[i].sobrenome, p[i].localidade); } printf("\n"); diff --git a/teste2copy.c b/teste2.1.c similarity index 100% rename from teste2copy.c rename to teste2.1.c diff --git a/teste6.c b/teste6.c new file mode 100644 index 0000000..314cc0a --- /dev/null +++ b/teste6.c @@ -0,0 +1,100 @@ +#include +#include +#include + +#define MAX_C 20 + +typedef struct s_pessoa { + + char nome[20]; + char username [20]; + char password [20]; + +} Pessoa; + +int login(Pessoa p) { + + char buffer[MAX_C]; + + char username_aux[MAX_C]; + char password_aux[MAX_C]; + + int valLength, valString, res, c; + + printf("----- Login -----\n"); + printf("Username: "); + fgets(username_aux, MAX_C, stdin); + username_aux[strlen(username_aux)-1] = '\0'; + printf("Password: "); + fgets(password_aux, MAX_C, stdin); + password_aux[strlen(password_aux)-1] = '\0'; + + + if((strlen(username_aux) == strlen(p.username)) && (strlen(password_aux) == strlen(p.password))) { + + valLength = 0; + + } else { + + valLength = 1; + } + + if((strstr(p.username, username_aux)) && (strstr(p.password, password_aux))) { + + valString = 0; + + } else { + + valString = 1; + } + + res = valLength + valString; + + if(res == 0) { + + printf("Login efetuado com sucesso!!\n"); + + } else { + + printf("Password e/ou Username errados!!\n"); + printf("prima (0) para sair ou (1) para tentar novamente\n"); + + do { + + fgets(buffer, MAX_C, stdin); + sscanf(buffer, "%d", &c); + + if(c == 1) { + + login(p); + + } else { + + exit(0); + + } + + } while (c != 1 || c != 0); + + } + + return res; + +} + +int main() +{ + Pessoa a; + strcpy(a.nome, "João"); + strcpy(a.username, "jpsaopedro"); + strcpy(a.password, "qwe123"); + + Pessoa b; + strcpy(b.nome, "Elsa"); + strcpy(b.username, "elsa"); + strcpy(b.password, "123qwe"); + + login(b); + + return 0; +} \ No newline at end of file