Loading...
Friday 28 July 2017

simple login program in C

Description of Program:

This is simple C Language program written in C Programming language, it takes user name and password from user as input through gets input function, than we have used if statement to check either the given user name and password are correct, we have used strcmp() function in if() statement which return false if user name or password does not match, also we have used textcolor() function for text color and textbackground() for background color . gotoxy(x,y) takes two parameters which is used to jump from one position to another, here "x" is horizontal position and "y" is vertical position. We have used here gotoxy() for positioning user name prompt i.e. “Enter user name”  and password prompt i.e. “Enter Password ” and  for some other statements.  We have also used gotoxy, textbackground() and textcolor() functions for creating progress bar we have used for loop counter variable as horizontal position value in gotoxy for changing the horizontal position simultaneously that gotoxy which is inside for loop will loop the backgroundcolor(WHITE)  which makes the progress bar. You can just type this program or copy and past into any editor or IDE  such as notepad, notepad++, Netbeans, Turbo C IDE,  DevC++ or any other IDE must save with .c extension, execute and then see the result. 

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
float i;
char user[10]="Waqas";
char password[10]="12345";
char password1[10];
char username[10];
textcolor(LIGHTRED);
textbackground(LIGHTBLUE);
clrscr();
gotoxy(5,10);
printf(" Enter username:");
gets(username);
gotoxy(5,12);
printf(" Enter password:");
gets(password1);
if(strcmp(user,username)==0 && strcmp(password,password1)==0)
{
gotoxy(5,15);
printf(" Access guranted Press Enter to continue....");
getch();
clrscr();
gotoxy(5,5);
printf("\n\t\t        Process the System files......");
 
for(i=1;i<=80;i++)
{
delay(100);
gotoxy(5,23);
printf(" Completed... %f %",i*1.25);
gotoxy(i,9);
textbackground(WHITE);
textcolor(WHITE);
cprintf("\n\n ",65);
}
printf("\n Progress is finished Press Enter............ ");
 
}
else
{
gotoxy(5,15);
printf(" Invalid user name or Password.");
}
getch();   
}

login example program in c language
Login Program in C Language 

  

0 Comments:

Post a Comment

 
TOP