You're online now.

Hurray! you are online now.

User login system in c programming language

In this program, we create a login system program which takes username and password from the user.

#include<stdio.h>
    #include<conio.h>
    #include<string.h>
    
    int main(){
    	char username[20];
    	char userpassword[20];
    	int i;
    	
    	printf("Enter the User Name : ");
    	gets(username);
    	
    	printf("Enter the Password : ");
    	gets(userpassword);
    	
    	printf("\n\n****\tEnter Any Key to Continue\t****");
    	getch();
    	
    	if(!strcmp(username, "exampleuser") && !strcmp(userpassword, "example123")){
    		printf("\n\n****\tLogin Successful\t****");
    	}else{
    		printf("\n\n****\tProvided Information Incorrect. Please Provide Right Information!!\t****");
    	}
    	return 0;
    }
  • Take username and password from the user.
  • After taking the value from the user then compare the value is correct or not.
  • If value is correct then “ Login successfull ” otherwise.
  • “ Invalid Credentials "
🖤 0
Buy me coffee ☕

Comments

Oops!

No comments here...