hye all :)

can u help me with this code:

int list[4][4] ={7,23,12,6,
	          2,1,4,10,
                 65,15,33,8,
                 18,26,42,12};
int i,j;

for (i=0;i<4;i++)
{
for(j=0;j<4;j++)
{
     cout<<list[i][j];
}
}

there's output but i want it to display 4X4

for (i=0;i<4;i++)
{
for(j=0;j<4;j++)
{
     cout<<list[i][j] << " "; // put a space between the characters on the same line
}
cout << endl; // start the next line
}

thnx,it works,but when i debug,there's four '0' at the bottom ?

>> thnx,it works,but when i debug,there's four '0' at the bottom ?

Then it doesn't work. But I don't get the zeroes. I don't see why you would get them either.

oh,my bad,thre's something wrong with my coding,tq for the helping :)

thelerner - Please mark the thread as solved. It helps so that the next reader does not read through your question only to find that it is no longer a question!

David

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.