#include
#include
#include
#include
using namespace std ;
void exchange(int a[][4],int row1,int row2)
{
int b[4][4];
int i,j,k;
i=0,k=0;
for(i=0;i<4;i++)
if (i==(row1-1))
{for(k=0;k<4;k++)
b[i][k]=a[row2][k];}
if(i!=(row1-1) && i!=(row2-1))
{ for(k=0;k<4;k++)
b[i][k]=a[i][k];
}
for(i=0;i<4;i++)
{ for (k=0;k<4;k++)
{cout<<b[i][k]<<'\t';}
cout<<'\n';}
}
int main ()
{
int a[4][4];
int x,y;
for (x=0;x
{ for (y=0;y
{ cin>>a[x][y];}
}
ofstream out;
out.open("data.txt");
if(!out)
{ cout <<"Can not open file:" <<"data.txt"<<endl;
exit(1);
}
for(x=0;x<4;x++)
{ for (y=0;y<4;y++)
{ out<<setw(8)<<a[x][y];}
out<<'\n';
}
int b[4][4];
ifstream in;
in.open("data.txt");
for (x=0;x<4;x++)
{ for (y=0;y<4;y++)
{in>>b[x][y];}
}
exchange(b,1,3);
out.close();
in.close();
return 0;
}