Include cstdlib and use std::atof.