Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions

Question

2x 2x 2x3 4 2X2 2 x 5x 2x3 1 8 x x 4x 11 2 + 2X2 = 4

Answered: 1 week ago

Question

9.3 Choose the close that will move your audience to take action

Answered: 1 week ago

Question

9.4 Balance the logical and emotional appeal of your message

Answered: 1 week ago