Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using c + + ; In the 2 0 2 0 grid far below, four numbers along a diagonal line have been marked in red.
Using c; 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 either recursive or nonrecursive method pt as starting points
Using c;
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 either recursive or nonrecursive method pt as
starting points
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