Tuesday, July 28, 2009

Find the area of the water body containing the grid(X,Y) ?I want this question program in c or cpp &algorithm?

1)Find area?


input will be M %26amp; N, where M is no.of grid cells in each row of the rectangle field and N be the no.of grid cells in each column of the rectangle field(get details either L or W L means Land, W means Water )for all the grid cells from the user . Then get XY reprensenting a grid cell. Find the area of the water body containing the grid(X,Y).





Sample input : M=6,N=5 consider field data


L L L W L


L L L W W


L W L L L


L W L L L


L W W L L


L W W W L





Suppose then the water body consisting of this grid will be having grids (3,2),(4,1)(5,2)(6,2)(6,3) find area of water body?








OUTPUT: area of water is =5.

Find the area of the water body containing the grid(X,Y) ?I want this question program in c or cpp %26amp;algorithm?
// i could try...





#include %26lt;iostream%26gt;


#include %26lt;iomanip%26gt;





int L ,W;


int main ()


{


cout %26lt;%26lt; please input the M and N


cin %26lt;%26lt; M %26lt;%26lt; N %26lt;%26lt; endl;


}


// is this the type of code you are considering, before i continue?


No comments:

Post a Comment