made C++ versions of scaleproc and addo