
December 18th, 2012, 11:50 PM
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 3
Time spent in forums: 23 m 34 sec
Reputation Power: 0
|
|
|
We work with Microsoft visual C++. I have started a) but I don`t know how to swap the even rows/colums.Here is what I have done so far.
#include<iostream.h>
#include<math.h>
double X[50][50];
double Y[50][50];
double Z[50][50];
int M,N,P,Q,S,k,i,j;
main () {
cout<<"Broi redove i stulbove v matr.X=";
cin>>M;
for (i=0;i<M;i++)
for (j=0;j<M;j++) { if (i%2==0){
cout<<"X["<<i<<"]["<<j<<"]=";
cin>>X[i][j];}
}
for (i=0;i<M;i++)
for (j=0;j<M;j++) {if (j%2==0){
cout<<"Y["<<i<<"]["<<j<<"]=";
cin>>Y[i][j];}}
return 0;
}
|