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

Write a simplie c++ program that does the follwoing . Password Verifier Imagine

ID: 3882877 • Letter: W

Question

Write a simplie c++ program that does the follwoing .

Password Verifier

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

The password should be at least 6 characters long.

The password should contain at least one uppercase and at least one lowercase letter.

The password should have at least 1 digit.

Write a program that asks for a password and then verifies that it meets the stated criteria. If it doesn't the program should display a message telling the user why.

Expected Output

When your solution is executed, it must match, verbatim, the following output, depending upon the use case:

User accepts auto-generated password

User changes password successfully

User changes password unsuccessfully

Explanation / Answer

Hi, here is the fully executable code with comments,

#include <iostream>

#include <regex>

using namespace std;

int main() {

string name;

cout<<"Enter your full name, including middle initial:"<<endl;

cin>>name;

cout<<"Your auto-generated password is: tnEDutS10"<<endl;

cout<<"Would you like to change your password now [Y|N]?:"<<endl;

char choice;

cin>>choice;

if(choice=='Y')

{

cout<<"Enter your password:"<<endl;

string str;

cin>>str;

if(str.length()>=6)

{

int flag1=0;

int flag2=0;

int flag3=0;

for(int i=0;i<str.length();i++) //checking for upper case

{

if(isupper(str[i]))

{

flag1=1;

}

}

if(flag1==1)

{

for(int i=0;i<str.length();i++) //checking for lowe case

{

if(islower(str[i]))

flag2=1;

}

if(flag2==1)

{

for(int i=0;i<str.length();i++) //checking for digit

{

if(isalnum(str[i]))

flag3=1;

}

if(flag3==1)

cout<<"Thank you. Please use your new password the next time you log into our system."<<endl;

else

{

cout<<"no digit"<<endl;

cout<<"We're sorry. Your password does not meet our requirements:"<<endl;

cout<<" * Your password does not contain at least one uppercase and one lowercase letter"<<endl;

cout<<" * Your password does not contain at least 1 digit"<<endl;

cout<<"Your password was not changed; it remains: tnEDutS10"<<endl;

cout<<"As a reminder, your password should"<<endl;

cout<<" * be at least 6 characters long"<<endl;

cout<<"* contain at least one uppercase and at least one lowercase letter"<<endl;

cout<<"* contain at least 1 digit"<<endl;

cout<<"It is recommended that you change your password the next time you log into our system."<<endl;

}

}

else // length is less than 6

{

cout<<"no lower case letter"<<endl;

cout<<"We're sorry. Your password does not meet our requirements:"<<endl;

cout<<" * Your password does not contain at least one uppercase and one lowercase letter"<<endl;

cout<<" * Your password does not contain at least 1 digit"<<endl;

cout<<"Your password was not changed; it remains: tnEDutS10"<<endl;

cout<<"As a reminder, your password should"<<endl;

cout<<" * be at least 6 characters long"<<endl;

cout<<"* contain at least one uppercase and at least one lowercase letter"<<endl;

cout<<"* contain at least 1 digit"<<endl;

cout<<"It is recommended that you change your password the next time you log into our system."<<endl;

}

  

}

else

{

cout<<"No upper case letter"<<endl;

cout<<"We're sorry. Your password does not meet our requirements:"<<endl;

cout<<" * Your password does not contain at least one uppercase and one lowercase letter"<<endl;

cout<<" * Your password does not contain at least 1 digit"<<endl;

cout<<"Your password was not changed; it remains: tnEDutS10"<<endl;

cout<<"As a reminder, your password should"<<endl;

cout<<" * be at least 6 characters long"<<endl;

cout<<"* contain at least one uppercase and at least one lowercase letter"<<endl;

cout<<"* contain at least 1 digit"<<endl;

cout<<"It is recommended that you change your password the next time you log into our system."<<endl;

}

  

}

else

{

cout<<"We're sorry. Your password does not meet our requirements:"<<endl;

cout<<"Your password length is less than 6"<<endl;

cout<<"Your password was not changed; it remains: tnEDutS10"<<endl;

}

}

else

{

cout<<"Thank you. It is recommended that you change your password the next time you log into our system."<<endl;

}

return 0;

}
Thumbs up if this was helpful, otherwise let me know in comments. Good Day.

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