add weight.cpp