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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education