c Programming Project
c Programming Project
h>
#include<conio.h>
#include<windows.h>
#define ENTER 13
#define TAB 9
#define BCKSPC 8
struct user{
char fullName[50];
char email[50];
char password[50];
char username[50];
char phone[50];
};
fgets(ch,50,stdin);
ch[strlen(ch) - 1] = 0;
for(int i=0;i<strlen(email);i++){
char ch;
while(1){
ch = getch();
pwd[i] = '\0';
break;
if(i>0){
i--;
printf("\b \b");
}else{
pwd[i++] = ch;
printf("* \b");
int main(){
system("color 0b");
FILE *fp;
int opt,usrFound = 0;
char password2[50];
printf("\n2.Login");
printf("\n3.Exit");
printf("\n\nYour choice:\t");
scanf("%d",&opt);
fgetc(stdin);
switch(opt){
case 1:
system("cls");
takeinput(user.fullName);
takeinput(user.email);
takeinput(user.phone);
takepassword(user.password);
takepassword(password2);
if(!strcmp(user.password,password2)){
generateUsername(user.email,user.username);
fp = fopen("Users.dat","a+");
fwrite(&user,sizeof(struct user),1,fp);
fclose(fp);
}
else{
Beep(750,300);
break;
case 2:
char username[50],pword[50];
takeinput(username);
takepassword(pword);
fp = fopen("Users.dat","r");
while(fread(&usr,sizeof(struct user),1,fp)){
if(!strcmp(usr.username,username)){
if(!strcmp(usr.password,pword)){
system("cls");
printf("\n\t\t\t\t\t\tWelcome %s",usr.fullName);
printf("\n\n|Full Name:\t%s",usr.fullName);
printf("\n|Email:\t\t%s",usr.email);
printf("\n|Username:\t%s",usr.username);
printf("\n|Contact no.:\t%s",usr.phone);
else {
printf("\n\nInvalid Password!");
Beep(800,300);
usrFound = 1;
if(!usrFound){
Beep(800,300);
fclose(fp);
break;
case 3:
return 0;
return 0;
Question