Question: Create a new C++ source file named hack.cpp and implement the function declared in hack.h, so that hack.cpp and the provided files compile into a

Create a new C++ source file named hack.cpp and implement the function declared in hack.h, so that hack.cpp and the provided files compile into a program that runs with no failed tests.

please use the files below passing all the test means it should output "Assignment complete."
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// (evilcomputer.h)
#ifndef EVILCOMPUTER_H #define EVILCOMPUTER_H #includeusing namespace std; class EvilComputer { public: // Creates a new evil computer with random passwords. EvilComputer(); // Creates a new evil computer with specific passwords. EvilComputer(string dave_pw, string mr_mean_pw, string ms_chief_pw, string dr_evil_pw); // Guess a password for an agent. // Returns whether the password guessed is correct. void guess(string user, string guess); // Returns whether an agent's password has been correctly guessed. bool is_hacked(string user); private: int index(string user); char random_char(); string passwords[5]; bool hacked[5]; }; #endif
///////////////////////////////////////////////////////////////////////////////////////////////////////////
//(evilcomputer.cpp)
#include#include #include #include "evilcomputer.h" using namespace std; EvilComputer :: EvilComputer(string dave_pw, string mr_mean_pw, string ms_chief_pw, string dr_evil_pw) { for (int i = 0; i //(hack.h)
#include "evilcomputer.h" void hack(EvilComputer* ec);//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//(main.cpp)
#include#include #include #include "evilcomputer.h" #include "hack.h" using namespace std; inline void _test(const char* expression, const char* file, int line) { cerr You haven hired by a coalition of nations to circumvent the security system of an evil caba In particular, you need to write a function that uses a brute-force approach to guess all possible passwords of three high-level cabal members: Mr. Mean, Ms. Chief, and Dr. Evil, and two other accounts, Guest and Dave. As you may know, recursion is often helpful in such a situation Previous intelligence gathering has determined that all five passwords have length at most 8 and contain only lowercase letters ( , a ,-'z' ) and digits ( , ? , , 9 , The following additional information about each password has also been uncovered: 1. Guest's password is "passw123" 2. Dave's password consists of exactly 4 digits. 3. Mr. Mean's password consists of only the characters 'g' and 'r' 4. Ms. Chief's password starts with "haha" 5. Dr. Evil's password starts or ends with the string "gato" Because of the cabal's security system, your function must be able to correctly guess all five pass- words in under three seconds. You haven hired by a coalition of nations to circumvent the security system of an evil caba In particular, you need to write a function that uses a brute-force approach to guess all possible passwords of three high-level cabal members: Mr. Mean, Ms. Chief, and Dr. Evil, and two other accounts, Guest and Dave. As you may know, recursion is often helpful in such a situation Previous intelligence gathering has determined that all five passwords have length at most 8 and contain only lowercase letters ( , a ,-'z' ) and digits ( , ? , , 9 , The following additional information about each password has also been uncovered: 1. Guest's password is "passw123" 2. Dave's password consists of exactly 4 digits. 3. Mr. Mean's password consists of only the characters 'g' and 'r' 4. Ms. Chief's password starts with "haha" 5. Dr. Evil's password starts or ends with the string "gato" Because of the cabal's security system, your function must be able to correctly guess all five pass- words in under three seconds
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
