Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in C++ Please Create a C++ program to check to see if a string exists in a given matrix of characters using recursion. Your program

image text in transcribedimage text in transcribed

in C++ Please

Create a C++ program to check to see if a string exists in a given matrix of characters using recursion. Your program should read the dimensions of the character matrix from an input file. It should then read the matrix and load it into a dynamically allocated 2D-array. Finally, it should read the string to be found. Output the word true if the string can be constructed from characters in the matrix, and the word false otherwise. The string can be constructed from a sequence of character of adjacent index, where adjacent an index is connected horizontally or vertically, but not wrapping around edges. 1. Input files - The first line of the input will contain two integers ' m ' and ' n ', separated by a single space. ' m ' represents the number of rows and ' n ' represents the number of columns. - The following ' m ' lines will each contain ' n ' number of characters, each character will be separated by a single space. - The last line in the input will contain the string to be searched in the matrix. - Each character in the matrix can only be used once, meaning that once a character has been visited, it cannot be visited again. - All character and string in the input will be in lowercase - There will be no extra lines and whitespaces in the input. 2. Output files - Output the word true if the string exists in the matrix; otherwise output the word false. input3.txt \begin{tabular}{|llllllllllll} 7 & 10 & & Output 3.txt \\ c & v & c & o & e & o & i & 1 & j & q \\ w & q & f & a & b & e & g & k & c & q \\ v & d & a & v & i & c & 1 & t & a & u \\ e & c & w & m & o & c & t & s & p & i \\ m & l & s & p & u & a & c & z & n & j \\ i & t & a & b & t & k & t & y & i & n \\ c & l & v & r & e & h & t & p & p & y \\ computer \end{tabular}

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

Students also viewed these Databases questions