c++ implementation of transportation problem