Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Needs to be C + + ( 1 ) Write a program that accepts a 2 - dimensional array ( matrix ) with n rows

Needs to be C++
(1) Write a program that accepts a 2-dimensional array (matrix) with n rows and m columns, where n and m are user-given
and prints out its transpose (i.e., every row in the original matrix becomes a column in the transpose matrix). For example, if the given matrix is
\table[[1,2,3,4],[5,6,7,8],[9,10,11,12]]
the transpose will be
\table[[1,5,9],[2,6,10],[3,7,11],[4,8,12]]
(2) Write a program that reads in a 2-dimensional array (matrix) with n rows and m columns where n and m are user-given and for each column it computes its average.
E.g., for the matrix
123
456
383
the average of 1st column is 3.333333, of 2nd column is 5.0, and of 3rd column is 4.0.
(3) Write a program using nested loops that asks the user to enter a value for the number of rows to display. It should then display that many rows of * and $, with
one * in the first row, two in the second row, and so on. However, the last * in each row should be aligned (preceded by as many $ as necessary).
A sample run would look like this:
Enter number of rows: 5
Then the * and $ should appear like this:
\table[[$,$,$,$,**
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

=+ a. The president raises taxes to reduce the budget defi cit.

Answered: 1 week ago