Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The program must be in C++ 10 19 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

The program must be in C++

image text in transcribed

10 19 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 0 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 0 0 0 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 0 0 0 0 0 4 5 6 7 8 9 10 11 12 13 14 15 16 0 0 0 0 0 0 0 5 6 7 8 9 10 11 12 13 14 15 0 0 0 0 0 0 0 0 0 6 7 8 9 10 11 12 13 14 0 0 0 0 0 0 0 0 0 0 0 7 8 9 10 11 12 13 0 0 0 0 0 0 0 0 0 0 0 0 0 8 9 10 11 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 10 11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 0 
Write a program that 1. reads matrix.txt into a 2D array; 2. construct the transpose of the input matrix with a function named transpose; 3. stores the result in matrix transpose.txt The first row of matrix.txt contains the number of rows and columns of the matrix. Below is the content ofmatrix.txt: 10 19 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 0 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 0 0 3 4 5 6 7 8 91011 12 13 14 15 16 17 e e 0 0 0 4 5 6 7 8 9 10 11 12 13 14 15 16 0 0 0 000056789101112131415 0000 0 0 0 0 0 6 7 8 9 10 11 12 13 14 0 0 0 0 0 00000078910111213000000 00000008910 11 12 0000000 0000000091011 0 0 0 0 0 0 e 0 1e 0 0 0 e0 0 0 0 0 e When the program is done, matrix_transpose.txt should be 19 10 2 2 e e e e e e e 0 3 3 3 0 e e 0 e 0 0 4 4 4 4e 0 0 0 0 5 5 5 5 5 0 e e 0 0 6 6 6 6 6 6 e e 0 0 8 8 8 8 8 8 8 8 e 0 9 9 9 9 9 9 9 9 9 0 10 10 10 10 10 10 10 10 10 18 12 12 12 12 12 12 12 12 e e 13 13 13 13 13 13 13 0 0 0 14 14 14 14 14 14 0 0 15 15 15 15 15 0 0 0 0 16 16 16 16 0 e e 0 0 18 18 000000 19 0 0 0 0 0 0 To read external file in C++, you need to include library. Below are steps in reading file: 1. Create an ifstream object: ifstream file_input("filename.txt"); 2. Retrieve input: file_input >> some_variable; 3. Close the file: file input.close(); To write a file is similar to reading file 1. Create an ofstream object: ofstream file_output ("filename.txt"); 2. Retrieve input: file_output

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

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago