In the c program, there are two global arrays of String namely emailArr and passArr. Implement the function signupUser() that takes two String as input, one for user email and another for password. You need to do the following checks: 1. Is the email in valid format? 2. Does the password contain at least 8 characters? 3. Does the password have both uppercase and lowercase letters? 4. Does the password contain digits? 5. Does the password contain any of the special characters ($ # * @)? If any of the checks returns false, the signup will not be successful. In that case you need to show proper error message, and return FAIL_VAL. Otherwise, the signup will be successful if all of these checks return true. In that case show success message

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;
            }


        }

}


In the c program, there are two global arrays of String namely emailArr and passArr. Implement the function signupUser() that takes two String as input, one for user email and another for password. You need to do the following checks:
1. Is the email in valid format?
2. Does the password contain at least 8 characters?
3. Does the password have both uppercase and lowercase letters?
4. Does the password contain digits? 5. Does the password contain any of the special characters ($ # * @)?

If any of the checks returns false, the signup will not be successful. In that case you need to show proper error message, and return FAIL_VAL. Otherwise, the signup will be successful if all of these checks return true. In that case show success message, return the array index, and store the user email and the password into emailArr and passAarr respectively.
N.B. You need to discard duplicate signup.

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