You want a "piecewise cubic spline". Google for "piecewise cubic spline C++" and you'll see several implementations. This type of spline interpolates between the control points using a cubic polynomial, with the conditions that the control points lie on the line and the slope of the two segments on either side of the control point is continuous. Thus you get a smooth curve that passes through each of the control points.