#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?

Recommended Answers

All 3 Replies

?

Sure, but what do YOU think is the right approach?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.