Create a registration form application by taking the details like username, address, phone number, email along with password and confirm password (sh

Leave a Comment
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
struct app{
char username[100], address[200];
long phone;
char email[100],password[100];
}a[5];

void feed(struct app a[])
{
char j[100];
int t,u,i,z,flag;
for(i=0;i<2;i++) { t=0;
printf("\nEnter for user number %d",i+1);
printf("\nEnter the name:");
scanf("%s",a[i].username);
printf("\nEnter address:");
scanf("%s",a[i].address);
printf("\nEnter you phone number:");
scanf("%ld",&a[i].phone);
printf("\nEnter the mail id:");
scanf("%s",a[i].email);
while(t!=1){

printf("\nNow Enter the PASSWORD(Of exactly 8 chars)\n");
for(u=0;u<8;u++) {
a[i].password[u]=getch();
printf("*");
}
printf("\nNow reEnter the PASSWORD\n");
for(u=0;u<8 data-blogger-escaped-br="" data-blogger-escaped-u=""> {
j[u]=getch();
printf("*");
} flag=0;

if(strcmp(a[i].password,j)==0)
{
for(z=0;z<8 data-blogger-escaped-br="" data-blogger-escaped-z=""> {
if(!(isalpha(j[z]))&&j[z]!='1'&&j[z]!='0'&&j[z]!='2'&&j[z]!='3'&&j[z]!='4'&&j[z]!='5'&&j[z]!='6'&&j[z]!='7'&&j[z]!='8'&&j[z]!='9')
{

flag=1;
}
}
if(flag==0)
t=1;
}
else
printf("\nPassword error, not same!!! or contain special charas.");
}
}

}
void retrive(struct app[])
{
int i,j;
for(i=0;i<2;i++)

{
printf("\n\nThe details of user %d are",i+1);
printf("\nUSER NAME:%s",a[i].username);
printf("\nAddress:%s",a[i].address);
printf("\nPnone number:%ld",a[i].phone);
printf("\nemail id:%s",a[i].email);
printf("\nPASSWORD:%s",a[i].password);
for(j=0;j<8;j++)

{
printf("*");

}
}
}

int main()
{
feed(a);
retrive(a);
getche();
return 0;
}

0 comments: