g through multi-dimensional arrays, functions, function overloading Instructions:     1) Write a SET OF 3 OVERLOADED functions called flipMatrixHorizontal() that takes the following inputs:     a) a 2-dimensional array with any number of rows and 3, 4, or 5 columns (this is where the overloading comes in).     b) an array to put the flipped array values in     c) number of rows     d) number of columns

Np Ms Office 365/Excel 2016 I Ntermed
1st Edition
ISBN:9781337508841
Author:Carey
Publisher:Carey
Chapter7: Developing An Excel Application
Section: Chapter Questions
Problem 1.5CP
icon
Related questions
Question

Mirrored Matrices

Concepts Tested: iterating through multi-dimensional arrays, functions, function overloading

Instructions:

    1) Write a SET OF 3 OVERLOADED functions called flipMatrixHorizontal() that takes the following inputs:

    a) a 2-dimensional array with any number of rows and 3, 4, or 5 columns (this is where the overloading comes in).

    b) an array to put the flipped array values in

    c) number of rows

    d) number of columns

  The function should reverse the ROWS (rotate around the horizontal axis)of the original array and put the new values in the flipped array. 

  

  2) Write a SET OF 3 OVERLOADED functions called flipMatrixVertical() that takes the following inputs:

  a) a 2-dimensional array with any number of rows and 3, 4, or 5 columns (this is where the overloading comes in).

  b) an array to put the flipped array values in

  c) number of rows

  d) number of columns

  The function should reverse the COLUMNS (rotate around the vertical axis)of the original array and put the new values in the flipped array. 

  

  3) You should have six functions when complete.  

 

  Example:

  Original 3 x 3 matrix:

 

  0   1   2

  3   4   5

  6   7   8

 

  Flipped vertically:

 

  2   1   0

  5   4   3

  8   7   6

 

  Flipped horizontally:

 

  6   7   8

  3   4   5

  0   1   2

 

code given: 

#include <iostream>
using namespace std;
 
// Fill in your 6 function definitions here. Empty shells for 2 of the 6 are provided. Start by creating the other 4 empty shells to get the test code to compile.  Once the file compiles, start filling in your functions. 
void flipMatrixVertical (int originalMatrix[][3], int flippedMatrix[][3], const int NUM_ROWS, const int NUM_COLUMNS){
// YOUR CODE HERE
}
 
 
void flipMatrixHorizontal (int originalMatrix[][3], int flippedMatrix[][3], const int NUM_ROWS, const int NUM_COLUMNS){
// YOUR CODE HERE
}
 
// YOUR CODE HERE (4 more functions)
 
 
#include "testcode.h" // for automated grading purposes; do not remove 
 
int main() {
 
  runTest(); //Code for automatic grading. DO NOT REMOVE 
 
}
 

** images show expected outcome **

 
Results:
Status
Input
Output
Expected
3x3 Vertical Passed
Original Matrix:
0 1 2
3 4 5
6 7 8
Flipped Matrix:
2
5
4
3
8
7.
1
3x3 Horizontal Passed
Original Matrix:
0 1 2
3 4 5
6
7
8
Flipped Matrix:
7
8
4
5
1
2
2
2x4 Vertical Passed
Original Matrix:
0 1
2 3
4 5 6 7
Flipped Matrix:
3
2
1
5
4
3
2x4 Horizontal Passed
Original Matrix:
0 1 2 3
6 7
Flipped Matrix:
4 5
N
63C
Transcribed Image Text:Results: Status Input Output Expected 3x3 Vertical Passed Original Matrix: 0 1 2 3 4 5 6 7 8 Flipped Matrix: 2 5 4 3 8 7. 1 3x3 Horizontal Passed Original Matrix: 0 1 2 3 4 5 6 7 8 Flipped Matrix: 7 8 4 5 1 2 2 2x4 Vertical Passed Original Matrix: 0 1 2 3 4 5 6 7 Flipped Matrix: 3 2 1 5 4 3 2x4 Horizontal Passed Original Matrix: 0 1 2 3 6 7 Flipped Matrix: 4 5 N 63C
3
2x4 Horizontal Passed
Original Matrix:
0 1 2 3
4 5 6 7
Flipped Matrix:
5 6 7
1 2 3
4
4
7x5 Vertical Passed
Original Matrix:
0 1
5 6 7
2
3
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Flipped Matrix:
4 3
2
9 8
7
14 13
12
11
10
19
18
17
16
15
24 23
22
21
20
29 28
27
26
25
34
33
32
31
30
5
7x5 Horizontal Passed
Original Matrix:
0 1
5 6
2
3
4
7
10 11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Flipped Matrix:
30
31
32
33
34
25 26
27
28
29
20
21
22
23
24
15
16
17
18
19
10
11
12
13
14
8
1
2
4
un
Transcribed Image Text:3 2x4 Horizontal Passed Original Matrix: 0 1 2 3 4 5 6 7 Flipped Matrix: 5 6 7 1 2 3 4 4 7x5 Vertical Passed Original Matrix: 0 1 5 6 7 2 3 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 Flipped Matrix: 4 3 2 9 8 7 14 13 12 11 10 19 18 17 16 15 24 23 22 21 20 29 28 27 26 25 34 33 32 31 30 5 7x5 Horizontal Passed Original Matrix: 0 1 5 6 2 3 4 7 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 Flipped Matrix: 30 31 32 33 34 25 26 27 28 29 20 21 22 23 24 15 16 17 18 19 10 11 12 13 14 8 1 2 4 un
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
CMPTR
CMPTR
Computer Science
ISBN:
9781337681872
Author:
PINARD
Publisher:
Cengage
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning