0
 #include<iostream>
    #include <iomanip>
    //#include<fstream>
    using namespace std;
    int main()
    {
    int input = 1;
    int matrix[3][4];
    int trans [4][3];
    for(int i=0; i<3; i++) //This loops on the rows.
    {
    for(int j=0; j<4; j++) //This loops on the columns
    {
    matrix[i][j] = input;
    input++;
    }
    }
    for(int i=0; i<3; i++) //This loops on the rows.
    {
    for(int j=0; j<4; j++) //This loops on the columns
    {
    cout << setw(2) << matrix[i][j] << " "; // setw(2) for alignment
    }
    cout << endl;
    }

    cout << endl;

    for(int i=0; i<4; i++) //This loops on the rows.
    {
    for(int j=0; j<3; j++) //This loops on the columns
    {   
    trans [i][j] = matrix [j][i];
    cout << trans [i][j] << " ";
    }
    cout <<   endl;
    }
    return 0;
    }

want to define a pointer that you can use to access the
Arrays made above. and then be able to print out elements x(1,3) and y(2,1) , these being examples. any ideas how to do so?

2
Contributors
3
Replies
4
Views
4 Years
Discussion Span
Last Post by rubberman
0

FWIW, we don't solve your class problems for you, but will help once you make an honest effort to do so yourself and have hit some wall.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.