Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Imagine you are developing a software package that requires the user to enter th

ID: 3809879 • Letter: I

Question

Imagine you are developing a software package that requires the user to enter their own passwords. Your software requires that user's passwords meet the following criteria:

The password should be at least 15 characters long

The password should contain at least one uppercase

The password should contain at least one lowercase letter

The password should contain at least one digit

The password should contain at least one symbol

The password should not have any consecutive characters identical

Write a program that asks for a password and verifies it meets the stated criteria, it does not require a good password to end, simply verifies is the password entered is good.

If the password does not meet requirements tell the user why. Ensure you use many well formed functions

Explanation / Answer

#include<stdio.h>

#include<conio.h>
#include<string.h>

char input[50],output[300];
int length=0,n=0,i=0,test1=0,test2=0,test3=0,test4=0,test5=0;
void check(char*);
char *msg1="consecutive characters identical ";
char *msg2="digit missing ";
char *msg3="Capital letter missing ";
char *msg4="Special character missing ";
char *msg5="Lower case letter missing ";
void main()
{
   clrscr();
   printf("Enter the password: ");
   gets(input);
   check(input);
   getch();
}

void check(char array[])
{
   length=strlen(array);
   if(length<15)
   {
       printf("length of password is <15...");
       exit(0);
   }
   else
   {
       for(i=0;i<length;i++)
       {
           if(array[i]==array[i+1])
           {
           test1=1;
           break;
           }
           else
           test1=0;
       }

       for(i=0;i<length;i++)
       {
           if((array[i]>=48&&array[i]<=58))
           {
           test2=0;
           break;
           }
           else
           test2=1;
       }

       for(i=0;i<length;i++)
       {
           if((array[i]>=65&&array[i]<=90))
           {
           test3=0;
           break;
           }
           else
           test3=1;
       }
       for(i=0;i<length;i++)
       {
           if((array[i]>=97&&array[i]<=122))
           {
           test5=0;
           break;
           }
           else
           test5=1;
       }

       for(i=0;i<length;i++)
       {
           if((array[i]>=0&&array[i]<=47)||(array[i]>=58&&array[i]<=64)||(array[i]>=91&&array[i]<=96)||(array[i]>=123&&array[i]<=127))
           {
           test4=0;
           break;
           }
           else
           test4=1;
       }
   }
   if(test1==0&&test2==0&&test3==0&&test4==0&&test5==0)
       printf("password has been created successfully!!!");
   else
   {

       if(test1==1)
           strcat(output,msg1);
       if(test2==1)
           strcat(output,msg2);
       if(test3==1)
           strcat(output,msg3);
       if(test4==1)
           strcat(output,msg4);
       if(test5==1)
           strcat(output,msg5);
   }
   puts(output);
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote