Hey
I'm trying to flip an apmatrix like this:
original matrix
0 1 2
3 4 5
flipped/reversed
543
210
So basically it takes the first number and flips it with the last number and does it til the end.. heres my code so far
Code:#include <iostream.h> #include "apmatrix.h" int main() { int x,y,num=0; cout<< "Num of Rows and Columns "; cin >> x; cin >> y; apmatrix <int> mat(x,y); int a,b; for (a=0;a<mat.numrows();a++) { for (b=0;b<mat.numcols();b++) { mat[a][b] = num; num++; } } cout <<'\n'; for (a=0;a<mat.numrows();a++) { for (b=0;b<mat.numcols();b++) { cout << mat[a][b]; cout << " "; } cout << endl; } // Reverse and Flip thing int z,b,length,temp; a=0; b=0; c=m.numrows(); d=m.numcols(); for ( return(0); }



LinkBack URL
About LinkBacks



