1. Implement the function searchByName() that takes one String input for name. You need to show the email, name, and address of those users found against that name. 2. Implement the function searchByAddress() that takes one String input for address. You need to show the email, name, and address of those users found against that address.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

#include<stdio.h>


#define FAIL_VAL -99999
#define SUCCESS_VAL 99999
#define MAX_USER 20
#define MAX_LEN 200

char emailArr[MAX_USER][MAX_LEN];
char passArr[MAX_USER][MAX_LEN];

char nameArr[MAX_USER][MAX_LEN];
char addressArr[MAX_USER][MAX_LEN];

int user_count=0;

int signupUser(char email[], char pass[]){
char Email_id[60];
int i;//p1=0,p2=0;
printf("Enter your Email_id: ");
scanf("%s", &Email_id);

if(Email_id[i]=='@' && Email_id[i]=='.')
{
printf("Your Email_id is valid");
}
else
{
printf("Email_id invalid.Please enter a valid id.");
}

}

int loginUser(char email[], char pass[]){
//Write your code here
}

int buildUserProfile(char email[], char firstName[], char lastName[], char address[]){
//Write your code here
}

void searchByName(char name[]){
//Write your code here
}

void searchByAddress(char address[]){
//Write your code here
}

int main()
{
while(1)
{
printf("*******************************************************************\n");
printf("1. signup User. 2. login User. 3. build User Profile. 4.Search By Name. 5. Search By Address. 6.exit \n");

int choice;
scanf("%d",&choice);

if(choice==1){

char mail[MAX_LEN], pass[MAX_LEN];
printf("give User Email :");
scanf("\n%[^\n]s",mail);
printf("give User Password :");
scanf("\n%[^\n]s",pass);
signupUser(mail,pass);
}

if(choice==2){

char mail[MAX_LEN], pass[MAX_LEN];
printf("give User Email :");
scanf("\n%[^\n]s",mail);

printf("give User Password :");
scanf("\n%[^\n]s",pass);

loginUser(mail,pass);
}

if(choice==3){

char mail[MAX_LEN], fname[MAX_LEN], lname[MAX_LEN], address[MAX_LEN];
printf("give User Email :");
scanf("\n%[^\n]s",mail);
printf("%s\n",mail);
printf("give First Name :");
scanf("\n%[^\n]s",fname);
printf("%s\n",fname);
printf("give Last Name :");
scanf("\n%[^\n]s",lname);
printf("%s\n",lname);
printf("give Address :");
scanf("\n%[^\n]s",address);
printf("%s\n",address);

buildUserProfile(mail,fname,lname,address);
}

if(choice==4){

char name[MAX_LEN];
printf("give User Name :");
scanf("\n%[^\n]s",name);

searchByName(name);
}

if(choice==5){

char address[MAX_LEN];
printf("give User Address :");
scanf("\n%[^\n]s",address);

searchByAddress(address);
}
if (choice==6){
break;
}


}

}



1. Implement the function searchByName() that takes one String input for name. You need to show the email, name, and address of those users found against that name.
2. Implement the function searchByAddress() that takes one String input for address. You need to show the email, name, and address of those users found against that address.

For both of these searches: the search should be case insensitive and allow substring properties. If search fails to find the data, show error message.

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY