Question: In the 2 0 2 0 grid far below, four numbers along a diagonal line have been marked in red. The product of these numbers
In the grid far below, four numbers along a diagonal line have been marked in
red. The product of these numbers is Write a program to
answer the question: what is the greatest product of adjacent numbers in the same
direction up down, left, right or diagonally in the grid?
gridtxt
Your program must accept the parameter from command line along with the name of
the grid file. It must output the positions of the numbers in the greatest product, the
actual numbers and the product. For example, to indicate the above four red numbers,
your program must print the following:
Example output input in bold:
Enter filename: gridtxt
Enter the adjacent number:
Maximum product in file "grid.txt
Row col :
Row col:
Row col :
Row col:
Max Product:
Note that the grid may be smaller or larger than but must always be a square
grid. If your program detects something other than a square grid, it should output an
error message. Also note that the user may request a larger than the grid, in which
case your program should also output an error message.
gridtxt
Example output input in bold:
Enter filename: gridtxt
Enter the adjacent number:
Maximum product in file "grid.txt
Row col :
Row col:
Max Product:
Please use "gridtxt and "gridtxt to test your program.
Submission detail:
Implement the program use both recursive and nonrecursive method pt as
starting point
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
