Write a program that would initialize two 2D-Arrays (matrix A and matrix B) using numbers n the range [1, 9], both boundaries included. Then, the program should ask user for a scale Eactor, an integer value in range [1,10], both boundaries included.

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

Can you please help me write the code in C++? It needs to be exactly wrote like the example in black. Also, if you can include a random number generator between [1,9] for the Matrixes then, that would be great.

Note: Use DO-WHILE loop to verify user input for scale factor.

2D-Array A:
5
3
5
6
9
2
1
3
5
6
2D-Array B:
3
4
6
5
3
7
3
3
1
1
2
1
4
1
3
6
4
Enter a scale factor in range (1, 101: 0
Invalid scale value!
Try again.
Enter a scale factor in range [1, 101: 11
Invalid scale value!
Try again.
Enter a scale factor in range [1, 101: 3
scale factor = 3
n+ B:
4
8
8
10
16
6
12
10
11
12
16
18
10
10
2
10
10
16
4
8
12
11
10
---
scale:
3
12
6
15
21
15
18
21
24
18
24
27
27
27
6
3
15
18
24
15
18
21
27
B* scale:
12
18
15
27
21
9
9
9
18
24
3
3
3
15
12
24
9
18
12
3
Press any key to continue
3.
6.
Transcribed Image Text:2D-Array A: 5 3 5 6 9 2 1 3 5 6 2D-Array B: 3 4 6 5 3 7 3 3 1 1 2 1 4 1 3 6 4 Enter a scale factor in range (1, 101: 0 Invalid scale value! Try again. Enter a scale factor in range [1, 101: 11 Invalid scale value! Try again. Enter a scale factor in range [1, 101: 3 scale factor = 3 n+ B: 4 8 8 10 16 6 12 10 11 12 16 18 10 10 2 10 10 16 4 8 12 11 10 --- scale: 3 12 6 15 21 15 18 21 24 18 24 27 27 27 6 3 15 18 24 15 18 21 27 B* scale: 12 18 15 27 21 9 9 9 18 24 3 3 3 15 12 24 9 18 12 3 Press any key to continue 3. 6.
Write a program that would initialize two 2D-Arrays (matrix A and matrix B) using numbers
in the range [1, 9], both boundaries included. Then, the program should ask user for a scale
factor, an integer value in range [1,10], both boundaries included.
The program should perform matrix addition and matrix-scalar multiplication.
At the end, program should display matrix A, matrix B, the result of the matrix addition, then
the scalar value with a label, and the result of its multiplication with matrix A and matrix B.
Matrix addition formula:
Ao,0 A0,1
[A10 A1,11
Bo,o Bo,1|
B11!
a0,0
+ bo,0 a0,1 + bo,1
]
%3D
a1,0 +
+ b1,0 a1,1 + b1,1
Matrix-scalar multiplication:
* scalar mo,1
* scalar
то,0 то,1
m1,0 m1,1.
mo,0
* scalar =
m1,0
* scalar m1,1
* scalar
Transcribed Image Text:Write a program that would initialize two 2D-Arrays (matrix A and matrix B) using numbers in the range [1, 9], both boundaries included. Then, the program should ask user for a scale factor, an integer value in range [1,10], both boundaries included. The program should perform matrix addition and matrix-scalar multiplication. At the end, program should display matrix A, matrix B, the result of the matrix addition, then the scalar value with a label, and the result of its multiplication with matrix A and matrix B. Matrix addition formula: Ao,0 A0,1 [A10 A1,11 Bo,o Bo,1| B11! a0,0 + bo,0 a0,1 + bo,1 ] %3D a1,0 + + b1,0 a1,1 + b1,1 Matrix-scalar multiplication: * scalar mo,1 * scalar то,0 то,1 m1,0 m1,1. mo,0 * scalar = m1,0 * scalar m1,1 * scalar
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE 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