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

please help me to code this one thank you Display the parameters of a valid pass

ID: 3671783 • Letter: P

Question

please help me to code this one thank you

Display the parameters of a valid password - minimum of 8 characters that includes at least one digit and at least one of the following special characters: ! @ # $ * Ask the user for a password then make sure it is valid, following the parameters listed above If the password is invalid, display one of the following error messages and loop until password is valid Invalid password - must be at least 8 characters Invalid password - must contain at least one digit Invalid password-must contain at least one of the following characters: ! @ # $ * (If more than one of these conditions are true, say less than 8 characters and no digit, you only need to display one of the appropriate error messages) -Once password is valid, confirm the password by having the user retype the password and comparing it to the originally entered password. If invalid, display an error message and loop until they type in the matching password. (For this lab, you do not need to allow them to reenter a new password.) -Once passwords match, write the password to a text file called Lab5.txt, but use the follow ing simple encryption - write the ASCII value for each character, separated by a comma. Write a 0 (zero) to indicate the end of the password. -Underneath the encrypted password, write the following WID# and test scores to the file (simply hardcode these in a println statement - add a delimiter of your choice) Verify the text file was written to properly by opening it. If not correct, modify code as needed to correct.

Explanation / Answer

void main() {

   int nob, now, nod, nov, nos, pos = high;

int char;

   char *str;

   nob = now = nod = nov = nos = 0;

   clrscr();

   printf("Enter any password : ");

   gets(str);

   while (*str != '') {

      if (*str == ' ') {

         // counting number of blank spaces.

         pos = high;

         ++nob;

      } else if (pos == high) {

         // counting number of words.

         pos = low;

         ++now;

      }

      if (isdigit(*str)) /* counting number of digits. */

         ++nod;

     

if (ischar(*str))

++char;

      /* counting number of special characters */

      if (!isdigit(*str) && !isalpha(*str))

         ++nos;

      str++;

   }

   printf(" Number of words  %d", now);

   printf(" Number of digits %d", nod);

   printf(" Number of special characters %d", nos);

if(nod <1)

{cout<<"invalid";

}

if(nos<1)

cout<<"invalid";

if(char<8)

cout<<"invalid";

   getch();

}