1. Engineering
  2. Computer Science
  3. integers create a c console program that searches through a...

Question: integers create a c console program that searches through a...

Question details

integers Create a C++ console program that searches through a matrix (2D vector) in order to find a pattern of 4 consecutive the same value. An array will not work for this assignment because by default they are statically allocated (versus dynamically allocated-at runtime). Include 3 separate void functions that receive the matrix as a parameter. One function you get that functioning properly, create a 2nd function that will search the matrix horizontally. The horizontal search shoul similar to the vertical search. After getting both of those working, create a 3rd function to search the matrix diagonally. This part will be the toughest If a patte from the function after finding the 1st pattern and print its location in the matrix. Optional Challenge: Continue searching the matrix and surround all matches with single quotes when printing. should search the matrix vertically. Once rn is found, print out the matrix with single quotes surrounding the integers that are part of the pattern. You may return From main, prompt the user to enter the dimensions of the matrix. It will be cumbersome to have the user enter in the values for the matrix. Instead, you may initialize the matrix by using a random number generator to generate single digit integers (numbers from the range 1-5 works better than 1-9 for testing purposes). After initializing the matrix, call all 3 functions to perform the searches!

No t lease enter the number of rows in the matrix. (minimum of four): I5 lease enter the number of columns in the matrix. (minimum of four): 15 orizontal 2 3 5 1 5 5 4 4 3 5 1 1 2 3 2 2 1 3 3 22 5 3 4 3 3 2 2 41 3 2 2 4 5 3 3 5 1 5 4 2 3 4 4 5 2 2 4 4 3 5 3 3 3 5 4 2 5 4 2 1 1 3 4 2 13 5 4 2 1 1 5 1 1 2 2 4 45 4 5 52 1 2 2 2 4 1 3 2 3333441 5 5 4 2 4 2 5 4 5 4 4 1 4 3 3 4 4 4 4 3 Vertical 1 2 2 4 4 5 4 5 5 2 1 2 2 2 4 5 5 2 4 3 4 4 3 5 2 4 1 5 4 5 1 3 2 4 2 2 1 5 3 1 5 3 4 3 3 2 1 2 2 1 3 1 5 2 3 1 1 2 5 2 1 3 2 3 3 3 3 44 1 5 5 424 3 2 2 1 4 4 1 2 3 1 1 5 53 4 4 1 2 3 1 2 2 5 1 2 2 4 5 4 5 2 5 4 5 44 1 4 3 3 4 4 443 2 1 3 455 2 1 2 1 5 5 2 4 4 5 4 5 55 3 11 4 443 5 44 iagonal
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution