gradient works in c++