
Newbies about array
Dear engineers
I have problem about the array 3X4 that pulled my hair for almost a week. I did search help, books, exercises and some net resource but seem did not help much. Here is the question: how do I make computer to understand that is " My_array [i][j]" when i input data from key board and use cout to print out the matrix 3x4. Also my second cout is to list the largest value from that matrix. Please direct if i made any mistake. Any help or suggestion is greatly appreciated. Thanks in advance for reading this message. Here is my code and this is the best of my knowledge:
#include <iostream.h>
#include <iomanip.h>
int main()
{
cout << "please enter three sets of five number!\n\n";
double check_num = 0; // initialize num, array's row and col
const int arrayrow = 3;
const int arraycol = 5;
int matrix[arrayrow][arraycol];
for (int x = 0; x < arrayrow; x ++){
for (int j = 0; j < arraycol; j++)
cin >>matrix [x][j];
if (check_num < matrix [x][j])
check_num = matrix[x][j];
cout << matrix[x][j]<<' ';
cout << "The biggest number is: "<<check_num;
cout << endl;
}
return 0;
}

#include <iostream.h>
#include <iomanip.h>
int main()
{
cout << "please enter three sets of five number!\n\n";
const int arrayrow = 3;
const int arraycol = 5;
int matrix[arrayrow][arraycol];
for (int x = 0; x < arrayrow; x ++)
for (int y = 0; y < arraycol; y++)
cin >>matrix [x][y];
int check_num = matrix[0][0];
// initialize to first num
for (x = 0; x < arrayrow; x ++)
{
for (y = 0; y < arraycol; y++)
{
cout << matrix[x][y] << " ";
if (matrix[x][y] > check_num)
check_num = matrix[x][y];
}
cout << endl;
}
cout << "The biggest number is: "<<check_num << endl;
return 0;
}

Ivan
Thanks very much. It worked like a charm. I have change the x and y from the loop of finding the biggest number because compiler said there are duplicated in initialize's name. I am wondering if your system are different from mine (pcwin 2000 professional)
#include <iostream.h>
#include <iomanip.h>
int main()
{
cout << "please enter three sets of five number!\n\n";
const int arrayrow = 3;
const int arraycol = 5;
int matrix[arrayrow][arraycol];
for (int x = 0; x < arrayrow; x ++)
for (int y = 0; y < arraycol; y++)
cin >>matrix [x][y];
int check_num = matrix[0][0]; // initialize to first num
for ( int e = 0; e < arrayrow; e ++)
{
for ( int d= 0; d< arraycol; d++)
{
cout << matrix[e][d] << " ";
if (matrix[e][d] > check_num)
check_num = matrix[e][d];
}
cout << endl;
}
cout << "The biggest number is: "<<check_num << endl;
return 0;
}
Moreover, I am wondering what is the different from ' ' and " ". I saw some example of c++ works just fine with the space of ' ' but in my case it did not work at all !!!. Once again thanks a bunch for your respond.