Jan 25, 2022

Login System code for basics (C Language)

Handling strings in C Lang.

 #include <stdio.h>
#include <string.h>

int main()
{
    char password[25], email[25];
    char default_email[25] = "cprogram@gmail.com";
    char default_password[25] = "c$program";

    printf("Enter Email :");
    scanf("%s", &email);
    if (strcmp(email, default_email) == 0)
    {
        printf("Enter Password :");
        scanf("%s", password);
        if (strcmp(password, default_password) == 0)
        {
            printf("Welcome %s user", email);
        }
        else
        {
            printf("Wrong Password");
        }
    }
    else
    {
        printf("Email doesn't exist.");
    }

    return 0;
}

No comments:

Post a Comment

Comparing two files in C language.

Operations on More than one File.    # include < stdio.h > # include < stdlib.h > # include < string.h > int main ( int ...