double dimentional array

Hello; dears
How r u?

I want to allow user to insert number in double array 2-D during the excution of program(output) by using c++ language without using pointer it can be???

example output::

enter number or rows: 3
enter number of columns: 4

enter elements of row 1:
1. 8
2. 3
3. 6 /// these values of elements && number of rows,coulmns inset by user in output

>>>>>>>etc ,, i want like this output

thank you.... whish your help
Last edited on
std::vector<std::vector<int> >
use matrix library, for instance blitz, eigen, hasem
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//simplistically you could set up and declare the array:
int rows=0,cols=0;
int value=0;
std::cout<<"\nenter number of rows ";
std::cin>>rows;
std::cout<<"\nenter nunber of columns ";
std::cin>>cols;
int array_b[rows][cols];
//then have the user fill it with values
std::cout<<"\nfill array_b with values\n";
int i,j;
for(i=0;i<rows;i++)
  {for(j=0;j<cols;j++)
    {
    std::cout<<"\nenter a value ";
    std::cin>>value;
    array_b[i][j]=value;
    }
  }
//and then print it out
for(i=0;i<rows;i++)
  {for(j=0;j<cols;j++)
     std::cout<<array_b[i][j]<<' ';
  }
Topic archived. No new replies allowed.