Question
Using C++ complete the code below by writing the codes for the functions 1- void search_in_rows(char A[][colms], int rows, string s) . 2- void search_in_colms(char
complete the code below
by writing the codes for the functions
1- void search_in_rows(char A[][colms], int rows, string s) .
2- void search_in_colms(char A[][colms], int rows, string s) .
3- void search_in_right_downward_diagonal(char A[][colms], int rows, string s) .
4- void search_in_right_upward_diagonal(char A[][colms], int rows, string s) .
________________________________________________________________________________________________
#include
#include
#include
#include
#include
using namespace std;
bool found=false;
const int colms=10;
void get_string_reverse(string input, string rev);
void generate_all_passwords(char A[][colms], int rows);
void print_all_passwords(char A[][colms], int rows);
//You have to write code for the following functions
void search_in_rows(char A[][colms], int rows, string s);
void search_in_colms(char A[][colms], int rows, string s);
void search_in_right_downward_diagonal(char A[][colms], int rows, string s);
void search_in_right_upward_diagonal(char A[][colms], int rows, string s);
int main() {
srand(time(0));
int rows=10;
string userPassword=\"\";
char all_passwords[rows][colms];
//generate large number of random passwords
generate_all_passwords(all_passwords, rows);
//print all the generated passwords
print_all_passwords(all_passwords, rows);
int choice=-1;
//get user password
do{
found=false;
cout
cout\"enter>
cin>>userPassword;
//cout\"\\t-----------searching>
search_in_rows(all_passwords, rows, userPassword);
//cout\"\\t-----------searching>
search_in_colms(all_passwords, rows, userPassword);
//cout\"\\t-----------searching>
search_in_right_downward_diagonal(all_passwords, rows, userPassword);
//cout\"\\t-----------searching>
search_in_right_upward_diagonal(all_passwords, rows, userPassword);
if(found){
cout\" congratulations>
}
else{
cout\" you>
}
cout\" enter>
cin>>choice;
}while(choice==1);
cout\" thanks>
return 0;
}
////////////////////////////////////////
string get_string_reverse(string input){
string rev=\"\";
for(int i=input.length()-1; i>=0; i--){
rev=rev+input[i];
}
return rev;
}
/////////////////////////////////////
void generate_all_passwords(char A[][colms], int rows){
int n=0;
for(int i=0; i;>
for(int j=0; j;>
n=random()%3;
//get random capital letter
if(n==0){
A[i][j]=65+random()%26;
}
//get random number
else if(n==1){
A[i][j]=48+random()%10;
}
else if(n==2){
A[i][j]=97+random()%26;
}
}
}
}
////////////////////////////////////////////////////
void print_all_passwords(char A[][colms], int rows){
cout
for(int j=0; j;>
cout
}
cout
for(int i=0; i;>
cout
for(int j=0; j;>
cout
}
cout
}
}
////////////////////////////////////////////////////////////
void search_in_rows(char A[][colms], int rows, string s){
}
////////////////////////////////////////////////////////////
void search_in_colms(char A[][colms], int rows, string s){
}
////////////////////////////////////////////////////////////
void search_in_right_downward_diagonal(char A[][colms], int rows, string s)
}
////////////////////////////////////////////////////////////
void search_in_right_upward_diagonal(char A[][colms], int rows, string s){
}
///////////////////////////////////////////////////////////
___________________________________________________________________________________________
to get like this sample run
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started