write a c program to Create a mail account by taking the
username, password, confirm password, secret_question,
secret_answer and phone number. Allow users to register,
login and reset password(based on secret question). Display
the user accounts and their details .

Answers were Sorted based on User's Feedback



write a c program to Create a mail account by taking the username, password, confirm password, secr..

Answer / puneet mittal

#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
char username[20][20],username1[20][20],answer[20][20];
int password[5],password1[5],password2[5],phno[5],n,i;
int confirmpassword[5],ans;
char qst[20][20];
char secretanswer[20][20];
printf("Number of user to create a mail account :");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\nusername :");
scanf("%s",username[i]);
pass:
printf("\npassword :");
scanf("%d",&password[i]);
printf("\nconfirm password:");
scanf("%d",&confirmpassword[i]);
if(password[i]==confirmpassword[i])
{
printf("Enter secret Question :");
scanf("%s",&qst[i]);
printf("Enter secret Answer:");
scanf("%s",&secretanswer[i]);
printf("Phone number :");
scanf("%d",&phno[i]);
}
else
{
printf("\n Repassword doesn't
match.Retype your password and confirm it again.");
goto pass;
}
printf("\n\nRegistration Succesful");
}
for(i=0;i<n;i++)
{
printf("\nLog in Account : \n");
pass1 :
printf("\nusername : \t");
scanf("%s",username1[i]);
printf("password :\t");
scanf("%d",&password1[i]);

if((password1[i]==password[i])&&((strcmp(username1[i],username[i])==0)))
{
printf("you want to reset your
password say 1/0 :");
scanf("%d",&ans);
if(ans==1)
{
pass2:
printf("answer the following : ");
printf("%s:",qst[i]);
scanf("%s",answer[i]);

if((strcmp(secretanswer[i],answer[i])==0))
{
printf("Enter new password :");
scanf("%d",&password2[i]);
}
else
{
printf("sereat answer is wrong ,
TRY AGAIN .");
goto pass2;
}
password[i]=password2[i];
printf("account detail :");
printf("username :%s",username[i] );
printf("\nPassword
:%d",password[i] );
printf("Phone number : %d
",phno[i]);
}
else
if(ans==0)
{
printf("account detail :\n\n");
printf("\n username
:%s\n",username[i] );
printf("\n Password
:%d\n",password[i] );
printf("\n Phone number : %d\n
",phno[i]);
}
}
else
{
printf("\nUsername or password
is wrong, TRy AGAIN. ");
goto pass1;
}
}
getch();
}

Is This Answer Correct ?    11 Yes 5 No

write a c program to Create a mail account by taking the username, password, confirm password, secr..

Answer / sandhiya.m

#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
char username[20][20],username1[20][20],answer[20][20];
int password[5],password1[5],password2[5],phno[5],n,i;
int confirmpassword[5],ans;
char qst[20][20];
char secretanswer[20][20];
printf("Number of user to create a mail account :");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\nusername :");
scanf("%s",username[i]);
pass:
printf("\npassword :");
scanf("%d",&password[i]);
printf("\nconfirm password:");
scanf("%d",&confirmpassword[i]);
if(password[i]==confirmpassword[i])
{
printf("Enter secret Question :");
scanf("%s",&qst[i]);
printf("Enter secret Answer:");
scanf("%s",&secretanswer[i]);
printf("Phone number :");
scanf("%d",&phno[i]);
printf("\n\n registration successfull");
}
else
{
printf("\n acount created not successful");
}
}
getch();
}

Is This Answer Correct ?    4 Yes 9 No

Post New Answer

More C Code Interview Questions

main() { int i = 3; for (;i++=0;) printf(ā€œ%dā€,i); }

1 Answers   CSC,


what is variable length argument list?

2 Answers  


Ramesh’s basic salary is input through the keyboard. His dearness allowance is 40% of basic salary, and house rent allowance is 20% of basic salary. Write a program to calculate his gross salary.

1 Answers  


Is the following code legal? struct a { int x; struct a b; }

1 Answers  


{ int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }

4 Answers  






main() { char *a = "Hello "; char *b = "World"; clrscr(); printf("%s", strcat(a,b)); } a. Hello b. Hello World c. HelloWorld d. None of the above

3 Answers   HCL,


int main() { int x=10; printf("x=%d, count of earlier print=%d", x,printf("x=%d, y=%d",x,--x)); getch(); } ================================================== returns error>> ld returned 1 exit status =================================================== Does it have something to do with printf() inside another printf().

2 Answers  


void main () { int x = 10; printf ("x = %d, y = %d", x,--x++); } a. 10, 10 b. 10, 9 c. 10, 11 d. none of the above

2 Answers   HCL,


Write a program to model an exploding firecracker in the xy plane using a particle system

0 Answers   HCL,


main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }

2 Answers  


why java is platform independent?

13 Answers   Wipro,


Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange

0 Answers  


Categories