int main ()
{
int line,column,i,j;
int sortir = 1;
float nbr;
cout << "The number of column :";
cin >> column;
cout << "The number of lines: ";
cin >> line;
float matrice [column][line]; //creating my 2d array
for(i=0;i <= line;i++) //asking the user to put the numbers he wants in the 2d array
for(j=0;j <= column;j++){
cout << "Enter a number";
cin >> nbr;
matrice[j][i] = nbr;
}
system("PAUSE");
return 0;
}
Lets say I do an array of line = 1 and column = 1 which makes (memory zones) [0,0] [0,1] [1,0] [1,1]. Let's say the user inputs these following numbers:
[0,0]=1
[0,1]=2
[1,0]=3
[1,1]=4
When I want to show the user what he inputted at the end of the program: the zone [0][1] and [1][0] show the same number?
cout << matrice[0][0] = 1
cout << matrice[0][1] = 3 <-- why the f***
cout << matrice[1][0] = 3 <--His my for loop good?
cout << matrice[1][1] = 4