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

This is what I have so far: #include <iostream> #include <string> #include <wind

ID: 3626710 • Letter: T

Question

This is what I have so far:

#include <iostream>
#include <string>
#include <windows.h>
#include <ctime>

using namespace std;

int passwordCheck();
int passwordGenerator();

int main()
{

string password;
int choice;

cout << "Choose an option: " << endl;
cout << "1. To check your own password." << endl;
cout << "2. To have one randomly generated. " << endl;
cin >> choice;
cout << endl;

if (choice ==1)
// Password Checker
{
string password;

cout << "Enter a password that fits the following criteria: " << endl;
cout << "Password must be between 5 and 12 characters, " << endl;
cout << "No uppercase, must contain numbers and letters, " << endl;
cout << "Can not have any repeating characters or numbers, " << endl;
cout << "Enter password here: ";
cin >> password;
cout << endl;

return (main());
}
else
// Password Generator
{
void clrscr();
{
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
COORD coord = {0, 0};
DWORD count;
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(hStdOut, &csbi);
FillConsoleOutputCharacter(hStdOut, ' ', csbi.dwSize.X * csbi.dwSize.Y, coord, &count);
SetConsoleCursorPosition(hStdOut, coord);
}

{
while (true)
{
clrscr();
srand(static_cast<unsigned int>(time(0)));
char lower[26] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'y', 'x', 'z' };
char num[10] = { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' };
string password;
for (int n = 0; n <= 5; n++)
{
password = password + lower[rand() % 25] + num[rand() % 25];
}
cout << "Your generated password:" << endl;
cout << password << endl;
cout << "Press 'enter' to generate another." << endl;
cin.get();
}
}

system ("pause");
return (main());
}
}

And here are my requirements:

In order to increase security the network manager has introduced some new rules concerning passwords:
Passwords must consist of a mixture of lowercase letters and numerical digits only, with at least one of each.
Passwords must be between 5 and 12 characters in length.
Passwords must not contain any sequence of characters immediately followed by the same sequence.
Generate a password based on the rules above.
Here are some examples:
cakeshop - rejected because it contains no numerical digit ?ab34 - rejected because it's too short ?A567xcz - rejected because 'A' is not allowed ?9apple8 - rejected because 'p' is immediately followed by 'p' ?03bananas - rejected because 'an' is immediately followed by 'an' ?123xy123 - accepted ('123' does not immediately follow '123')

Any help would be appreciated.

Explanation / Answer

Dear... The code below is modified code of yours, only for password checker. It seems that you figured out password generator and your requirements are only for password checker, below is the code as per your requirements. Do not see the message displayed in the output like "Rejected (password is short/long)", i just wanted to check from where the message is displayed, you can use just "Rejected" Modified code is in blue color: code: #include #include #include #include using namespace std; int passwordCheck(); int passwordGenerator(); bool Match(string); int main() { string password; int choice; int i; cout
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