Add the correct code to fill the matrix array with the value

Assignment Help C/C++ Programming
Reference no: EM13163430

Use the file below code and add the correct code to fill the matr2 array with the values that make it the matrix transpose of matr1. There are many examples on the Internet that show how to do this in C++ and what it should look like when it is correct.

#include <cstdlib>

#include <ctime>

#include <iostream>

#include <iomanip>

 

const int ROWS = 6;

const int COLS = 7;

 

using namespace std;

 

int main()

{

srand((unsigned)time(0));

int i, j, matr1[ROWS][COLS];

for(i=0; i<ROWS; i++)

{

for (j=0; j<COLS; j++)

{

matr1[i][j] = (rand()%500)+1;

cout << setw(5) << matr[i][j];

}

cout << endl;

}

cout << endl << endl;

 

// transpose

int matr2[COLS][ROWS];

 

 

// display second matrix

for (i=0; i<COLS; i++)

{

for (j=0; j<ROWS; j++)

cout << setw(5) << matr2[i][j];

cout << endl;

}

}

 

 

Reference no: EM13163430

Questions Cloud

Implement a standard sorted linked list class : Write C++ Program:Implement a standard SORTED linked list class. Be sure to include constructor/copy constructor, destructor, and assignment operator overload.
Compute the zero-point energy of a harmonic : Calculate the zero-point energy of a harmonic oscillator consisting of a rigid CO molecule adsorbed to a metal surface by a bond of force
State what is the heat of vaporization of ethanol : The heat of fusion, ?Hfus, of ethanol (C2H5OH) is 4.9 kJ/mol. The heat of sublimation of ethanol, for the process C2H5OH(s) ? C2H5OH(g) , is 43.5 kJ/mol. What is the heat of vaporization of ethanol?
Computer program that inputs a degree : Write a computer program that inputs a degree of difficulty and seven judges' scores, and outputs the overall score for that dive. The program should ensure that all inputs are within the allowable data ranges
Add the correct code to fill the matrix array with the value : Use the file below code and add the correct code to fill the matr2 array with the values that make it the matrix transpose of matr1. There are many examples on the Internet that show how to do this in C++ and what it should look like when it is corre..
Compute the downward pressure in pascals due to gravity : Calculate the downward pressure in pascals due to gravity exerted by the bottom face of a 3.25kg cube of iron that is 7.50 cm
Calculate the concentration of sodium ion in a solution : Calculate the concentration of sodium ion in a solution made by diluting 350.0 mL of 3.00 M sodium carbonate to a total volume of 2.00 L.
Determine molar mass for this compound and oxidation state : Determine molar mass for this compound and oxidation state of lead in it. write the oxide formula of lead for the corresponding oxidation state
Write a program that allows users to enter a dollar amount : Write a program that allows users to enter a dollar amount for their bank account balance at the beginning of the month.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Multidimensional arrays

multidimensional arrays to life, let's consider a specific example: How can you visualize a 4-dimensional array? How can you give meaning to each dimension this array has? What kind of application would such an array be useful for?

  Native method with deadlock detection and recovery

The naïve method with deadlock avoidance and the naïve method with deadlock detection and recovery - what will you measure and compare in order to determine the winner or which is better

  Write main function to compute stress-strain in steel rod

Write a main function and the following functions to compute the stress and strain in a steel rod of diameter D (inches) and length L (inches) subject to the compression loads.

  Write a program to accept a number representing

Write a program to accept a number representing how many first names the user willenter from the command line (5 names maximum), and the actual first names, fromthe command line. Create an array dynamically that has the same size as number ofnames.

  Write function to find whether number is perfect number

Write down the function perfect which determines whether number is perfect number or not. This function must receive number and return true if number is perfect.

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write an input validation loop

write an input validation loop that asks the user to enter a number in the range of 1 through 4.

  During the execution of the above code, how many instru

(a) During the execution of the above code, how many instructions are executed? (b) Assuming a standard unicycle machine (CPI = 1) running at 100 KHz, how long will the above code take to complete?

  Write a driver program called testrationalnumber.cpp

Write a driver program called testRationalNumber.cpp to test each of the above functions and overloaded operators in the RationalNumber class.

  Write a program using vectors and iterators

Create a program that uses at least two functions that will be called from your main. This program is a number game program that asks for parts of your phone and after manipulating it mathematically, eventually outputs your entire phone number. The d..

  In c++, write a program that calculates 10,000 tries.

In C++, write a program that calculates 10,000 tries. These tries are based upon a rat trying to escape from a maze. Keep adding minutes until the rat is free and when he is free that is 1 try so we need 10,000. We start by randomly generating a numb..

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd