Question: In C++ please! Warning: do not use vectors in this exercise. Write a program that reads a character into a char variable and 15 integers
In C++ please!
Warning: do not use vectors in this exercise.
Write a program that reads a character into a char variable and 15 integers into a 2D integer array with 3 rows and 5 columns, and performs the following tasks:
(1) Reprint the 2D array
(2) Compute and output the sum of the numbers by row or by column according to the character entered by the user (c = by column, r = by row).
For example, if the user enters
r 5 7 3 4 6 6 4 3 8 1 5 6 9 5 5
The program will output
5 7 3 4 6 6 4 3 8 1 5 6 9 5 5 25 22 30
If instead the user enters
c 5 7 3 4 6 6 4 3 8 1 5 6 9 5 5
The program will output
5 7 3 4 6 6 4 3 8 1 5 6 9 5 5 16 17 15 17 12
You can assume the input is always correct (either r or c, and 15 numbers).
Any attempt to hard code answers will result in a 0 for the exercise.

Warning: do not use vectors in this exercise. Write a program that reads a character into a char variable and 15 integers into a 2D integer array with 3 rows and 5 columns, and performs the following tasks: (1) Reprint the 2D array (2) Compute and output the sum of the numbers by row or by column according to the character entered by the user (C = by column, r = by row). For example, if the user enters r 5 7 3 4 6 6 4 3 8 1 5 6 9 5 5 The program will output 5 7 34 6 6 4 3 8 1 5 6 9 5 5 25 22 30 If instead the user enters 5 7 3 4 6 6 4 3 8 1 5 6 9 55 The program will output 5 7 34 6 6 4 3 8 1 5 6 9 5 5 16 17 15 17 12 You can assume the input is always correct (either rorc, and 15 numbers). Any attempt to hard code answers will result in a 0 for the exercise
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
