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

void main() { int c; c=printf("Hello world"); printf("\n%d",c); }

2 Answers  


How to use power function under linux environment.eg : for(i=1;i<=n;i++){ pow(-1,i-1)} since it alerts undefined reference to 'pow'.

2 Answers  


main() { int *j; { int i=10; j=&i; } printf("%d",*j); }

9 Answers   HCL, Wipro,


#define clrscr() 100 main() { clrscr(); printf("%d\n",clrscr()); }

2 Answers  


how to swap 3 nos without using temporary variable

4 Answers   Satyam,






main() { extern int i; i=20; printf("%d",sizeof(i)); }

2 Answers  


Which one is taking more time and why ? :/home/amaresh/Testing# cat time.c //#include <stdio.h> #define EOF -1 int main() { register int c; while ((c = getchar()) != EOF) { putchar(c); } return 0; } ------------------- WIth stdio.h:- :/home/amaresh/Testing# time ./time_header hi hi hru? hru? real 0 m4.202s user 0 m0.000s sys 0 m0.004s ------------------ Witout stdio.h and with #define EOF -1 =================== /home/amaresh/Testing# time ./time_EOF hi hi hru? hru? real 0 m4.805s user 0 m0.004s sys 0 m0.004s -- From above two case , why 2nd case is taking more time ?

0 Answers  


Set up procedure for generating a wire frame display of a polyhedron with the hidden edges of the object drawn with dashed lines

0 Answers   IBM,


programming in c lanugaue programm will errror error with two header file one as stdio.h and other one is conio.h

1 Answers  


#include<stdio.h> main() { register i=5; char j[]= "hello"; printf("%s %d",j,i); }

2 Answers  


Write a program that find and print how many odd numbers in a binary tree

1 Answers  


What is the problem with the following code segment? while ((fgets(receiving array,50,file_ptr)) != EOF) ;

1 Answers  


Categories