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

Many user-created passwords are simple and easy to guess. Write a program that t

ID: 3715386 • Letter: M

Question

Many user-created passwords are simple and easy to guess. Write a program that takes a simple password and makes it stronger by replacing characters using the key below, and by appending q*s" to the end of the input string · i becomes ! a becomes @ m becomes M · B becomes 8 . o becomes If the input is mypassword, the output is: Myp@ssw.rdq*s ACTIVITY 4.15.1: CH4 LAB: Password modifier 0/10 main.cpp Load default template 1 #include #include 3 using namespace std; 5 int mainO 7Type your code here. 9, return e; 10

Explanation / Answer

#include <iostream>
using namespace std;


int main() {
char ch[5] = {'i','a','m','B','o'};
char r[5]= {'!','@','M','8','.'};
string pass,newStr = "";
cout<<"Enter the password: "<<endl;
cin >> pass;
bool found = false;
for(int i=0;i<pass.length();i++) {
found = false;
for(int j=0;j<5;j++) {
if(ch[j] == pass[i]) {
found=true;
newStr=newStr+r[j];
break;
}
}
if(!found) {
newStr=newStr+pass[i];
}
}
newStr = newStr +"q*s";
cout<<newStr<<endl;
return 0;
}

Output:

Enter the password: mypassword
Myp@ssw.rdq*s