I need to create a program in c that analyzes whether two passwords typed match

Asked

Viewed 19 times

0

Statement of the financial year: Write a program to verify a password entered by the user. Ask the user to enter a password and then he must write it in another field. Compare the entered values and send a message stating whether typed passwords are equal or not.

My code so far:

#include <stdio.h>
#include <stdlib.h>

int main(){ 
char senha1 [100];
char senha2[100];
    printf("Digite sua senha:\n");
    gets(senha1);
    
    printf("Confirme sua senha:\n");
    gets(senha2);

    if (senha1==senha2) 
       printf("As senhas estao correspondentes");
  
    if (senha1 != senha2)
    printf("As senhas nao coincidem");
    
    return 0;       
}

The program does not recognize when the passwords are equal, I wanted to know what is wrong, I am still beginner.

I cannot use string functions. h

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.