In this section, we will write a little game that prompts the user to enter a specific word. The time that the user needs to type this word into the keyboard is measured and displayed in multiple time units:
- At first, we need to include all the necessary headers. For reasons of comfort, we declare that we use the std namespace by default:
#include <iostream> #include <chrono> #include <ratio> #include <cmath> #include <iomanip> #include <optional> using namespace std;
- The chrono::duration as a type for time durations usually refers to multiples or fractions of seconds. All the STL time duration units refer to integer typed duration specializations. In this recipe, we are going to specialize on double. In the recipe after ...