cpp implementation of Gas Station