Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

2 Four in a Diagonal Line You are given a two-dimensional array of size 6x7 that

ID: 3730478 • Letter: 2

Question

2 Four in a Diagonal Line You are given a two-dimensional array of size 6x7 that contains 1's, 2's, and 3's. Write a function that determines if there are four 1's or 2's in a diagonal line. Your function should ignore 3's. Also, do not check the reverse-diagonals Develop a program that e Reads a 6x7 t sional array from file test diagonals.trt (create that file). Modify the function readar from problem 1 to create void read mat (FILE *in, int xL1 171); Checks if there is a diagonal line of four 1's, or four 2's. Pass back true (1) if a diagonal is found, false (0) otherwise. Use the function prototype int CheckDiagonals (int x[I[7], int TestInt); TestInt is either 1 or 2 since the function is to decide whether a diagonal of four 1's or 2's exists. Prints the result to the screen Example 1 1 3 3 3 3 3 3 1 3 3 3 2 3 3 3 3 2 1 3 3 3 3 2 3 3 3 2 3 No diagonals found in the matrix Example 2 1 3 3 3 33 3 11 3 3 2 3 3 3 3 21 33 3 3 2 3 3 3 2 3 At least one diagonal of four 1's exists in the matrix Example 3 1 3 3 3 33 3 -13312333 3 3 2 1 2 3 3 3 2 3 3 3 2 3 At least one diagonal of four 1's exists in the matrix At least one diagonal of four 2's exists in the matrix

Explanation / Answer

Hi buddy,

Since it's a programming question, Hope the commented code will explain everything.. If not, feel free to ask for doubts if any.

//Player Stats

All the best.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote