/****************************************************************************** * This program demonstrates timing of code. * * Copyright © 2021 Richard Lesh. All rights reserved. *****************************************************************************/ #include #include #include #include using namespace std; int main(int argc, char **argv) { long start = (clock() * 1000) / CLOCKS_PER_SEC; for (int x = 1; x < 10000; ++x) { cout << fmt::format("{0:d}^2 = {1:d}", x, x * x) << endl; } long stop = (clock() * 1000) / CLOCKS_PER_SEC; cout << fmt::format("Duration: {0:d} ms", stop - start) << endl; return 0; }