-
Book Overview & Buying
-
Table Of Contents
C++17 STL Cookbook
By :
Since C++11, the STL contains some new types and functions for taking, measuring, and displaying time. This part of the library exists in the std::chrono namespace and has some sophisticated details.
In this recipe, we will concentrate on measuring time spans and how to convert the result of the measurement between units, such as seconds, milliseconds, and microseconds. The STL provides facilities, which enable us to define our own time units and convert between them seamlessly.
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:
std namespace by default: #include <iostream>
#include <chrono>
#include <ratio>
#include <...
Change the font size
Change margin width
Change background colour