ayushk1

Member • Nov 20, 2011

## C++ not getting the output,What is wrong?

Here is a C++ program which is as follows

"

#include

int z[3][4]={1,2,3,4,5,6,7,8,9,10,11,12};

void main()

{

int a,b,c;

for(a=0;a<3;++a) {

c=999;

for(b=0;b<4;++b)

if(z[a]

;

cout<
}

}

"

When I compile it,it doesn't show any errors,

but the program still doesn't run.It initializes and stops in between.

Can someone correct the program and tell me the output.

Also,here is an interesting question-

"A two dimensional array of size 4x4 has three different possible values.The values of the array could be 0,1 or 2.These values are input from the user via keyboard.Display the matrix.For all the values of 2 in the array,determine whether in the adjacent diagonal(either top or bottom and either left or right) whether any 1 is present.If so,display the position of such 1s corresponding to various 2s."

I'm having a hard time finding the answer,can somone plz help me out?

Thanks

cout<

}

"

When I compile it,it doesn't show any errors,

but the program still doesn't run.It initializes and stops in between.

Can someone correct the program and tell me the output.

Also,here is an interesting question-

"A two dimensional array of size 4x4 has three different possible values.The values of the array could be 0,1 or 2.These values are input from the user via keyboard.Display the matrix.For all the values of 2 in the array,determine whether in the adjacent diagonal(either top or bottom and either left or right) whether any 1 is present.If so,display the position of such 1s corresponding to various 2s."

I'm having a hard time finding the answer,can somone plz help me out?

Thanks