Isaac7573 Isaac7573
  • 17-01-2020
  • Computers and Technology
contestada

Given two 3x3 arrays of integer, x1 and x2, write the code needed to copy every value from x1 to its corresponding element in x2.

Respuesta :

femotinga femotinga
  • 19-01-2020

Answer:

#include<iostream>

#include<iomanip>

using namespacestd;

int main ()

{

int x1[3][3]={1,2,3,4,5,6,7,8,9};

int x2[3][3];

int i,j;

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

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

x2[i][j] = x1[i][j];

cout<<"copy from x1 to x2 , x2 is :";

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

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

cout<<x2[i][j]<<" ";

cout<<endl;

system("pause");

return 0;

}

/* Sample output

copy from x1 to x2 , x2 is :1 2 3 4 5 6 7 8 9

Press any key to continue . . .

*/

Explanation:

Answer Link

Otras preguntas

if 3t-7=5t, then 6t=?
what is case-based reasoning?
5 sentences about outdoor recreation that will help me revise for a test
Do you add them both together or multiply or do u put an equal sign between them? what is the sum of [tex] \frac{-x+7}{2x+4} [/tex] and[tex] \frac{2x+5}{2x+4} [
what should i know about pride and prejudice?
If you start skating down this hill, your potential energy will be converted to kinetic energy. At the bottom of the hill, your kinetic energy will be equal to
What kind of organic compound is oxybenzone?
An investment club invested part of $8000 at 10% annual interest the rest at 12%. If the annual income from these investments is $900, how much was invested at
what should i know about pride and prejudice?
An 81 kg stuntman jumps from the top of a building 29 m above a catching net. Assuming that air resistance exerts a 100 N force on the stuntman as he falls, det