Discuss Help with a course assigment-matrices in the C/C++ Help forum on Dev Articles. Help with a course assigment-matrices C/C++ Help forum discussing building and maintaining applications in C/C++. Find out why these languages are the foundation on which other languages are built.

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];}}