Registration and Login Application Using Functions in C Programming

#include <stdio.h>
#include <string.h>
void Reg();
void Login();
void Data();
char fn[20],ln[20],add[20],ph[20],u1[25],u2[25],pwd1[25],pwd2[25];

main()
{
Reg();
}

void Reg()
{
printf("Enter 1st Name:");
scanf("%s",&fn);
printf("Enter last Name:");
scanf("%s",&ln);
printf("Enter address:");
scanf("%s",&add);
printf("Enter phone:");
scanf("%s",&ph);
printf("create user name:");
scanf("%s",&u1);
printf("create your password:");
scanf("%s",&pwd1);
printf("Registration success");
Sleep(1000);
system("cls");
Login();
}

void Data()
{
printf("Hai .. %s\n",u1);
printf("Full Name:%s\n",strcat(fn,ln));
printf("Address:%s\n",add);
printf("Phone:%s\n",ph);
}
void Login()
{
printf("Enter your user name:");
scanf("%s",&u2);
printf("Enter your password:");
scanf("%s",&pwd2);
system("cls");
if(strcasecmp(u1,u2)==0&&strcmp(pwd1,pwd2)==0)
{
Data();
}
else
{
printf("Invalid user name or pwd");
}
}

0 Comments