Feb 17, 2014 at 4:05am Feb 17, 2014 at 4:05am UTC
Write your question here.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#include<iostream>
using namespace std;
int main()
{
int matrix[2][3], row, col, maxrows = 2, maxcols = 3;
// get values for the matrix
for (row = 0; row < maxrows; row++)
{
for (col = 0; col < maxcols; col++)
{
cout << "Please enter a value for position[" << row << "," << col << "]" ;
cin >> matrix[row][col];
}
}
// Display The values of matrix
cout << "The values entered for the matrix are:" << endl;
for (row = 0; row < maxrows; row++)
{
for (col = 0; col < maxcols; col++)
{
cout << "\t" << matrix[row][col];
}
cout << endl;
}
}
my question is is pretty stupid but it confused me so i just thought to ask it here the line
cin >> matrix[row][col];
is it reading the values in row and column on each repetition of the inner loop one by one or that the values just going to matrix array with the size of 2 and 3.
Last edited on Feb 17, 2014 at 4:20am Feb 17, 2014 at 4:20am UTC
Feb 17, 2014 at 12:04pm Feb 17, 2014 at 12:04pm UTC
Last edited on Feb 17, 2014 at 12:10pm Feb 17, 2014 at 12:10pm UTC
Feb 19, 2014 at 9:06am Feb 19, 2014 at 9:06am UTC
its a long read but i can follow it in some time thanks