Which is equal to what in C?
This?
cvMoments(imgYellowThresh, moments, 1);
That's a big difference.
ourMoment=moments(imgYellowThresh); //calculat all the moment of image
cvMoments(imgYellowThresh, moments, 1);
This isn't about C and C++ differences; it's more about what you have written is nonsensical and makes no sense (in C++).
I don't know much abt c++ code but I found it some where in net.