Sunday, August 2, 2009

How d you compare two rows of a multidimensional array in c++?

What are you comparing (characters, numbers, ...)?


How do you want to compare it (greater than, less than, equal to, ...)?





The basic structure is,


if ([Object1] opperator [Object2])


{


//code to be executed if true


}





Object1 and Object2 are the elements of the array you want to compare. The opperator is how you want to compare them, for example, == or %26gt; or %26lt; or != or %26lt;= and so on.

How d you compare two rows of a multidimensional array in c++?
template %26lt;class T%26gt;


bool RowCompare( int row1, int row2, const std::vector%26lt; std::vector%26lt; T %26gt; %26gt;%26amp; myarray )


{


return myarray[row1] == myarray[row2];


}

tomato plants

No comments:

Post a Comment