CodeTheRobot

C++ Intermediate · exercise 04

Templates & concepts

Write one interpolator that serves scalars and 2D points.

C++ Intermediate lesson 04

Guided steps

  1. 1.Write a template function lerp that works for any type supporting + and *.
  2. 2.Add the operators Point needs so the same template compiles for it.
  3. 3.Interpolate halfway and print both results.

Your code

Your code is saved in this browser after every run and restored next time.