Răspuns :
Răspuns:
#include <iostream>
using namespace std;
int main()
{
int m,n,i,j,p,q;
float t, a[100][100];
cout << "nr linii: m="; cin >> m;
cout << "nr coloane: n="; cin >> n;
cout << "introdu matricea cu numere reale:" << endl;
for (i=1; i<=m; i++)
{
for (j=1; j<=n; j++)
cin >> a[i][j];
}
cout << "p="; cin >> p;
cout << "q="; cin >> q;
for (i=1; i<=m; i++)
{
t=a[i][p];
a[i][p]=a[i][q];
a[i][q]=t;
}
cout << "matricea modificata:" << endl;
for (i=1; i<=m; i++)
{
for (j=1; j<=n; j++)
cout << a[i][j] << " ";
cout << endl;
}
return 0;
}
Explicație: