I have this assignment I have to do for my data structures and algorithms class. I have to display the execution times for how long my sorts take. I managed to display the duration but my professor wants me to display the start time and end time.
Here is a snippet of me displaying the duration. Note that a majority of the code is cut off.
#include <iostream>
#include <iomanip>
#include "stdafx.h"
#include <chrono>
using namespace std;
using namespace std::chrono;
int main()
// Starting time for the clock.
auto start = high_resolution_clock::now();
// Insert sorting function code here.
// Ending the time for the clock.
auto stop = high_resolution_clock::now();
// Getting the duration of how much time was passed.
auto duration = duration_cast<microseconds>(stop - start);
cout << "Time taken by insertion sort: " << duration.count() << " microseconds" << endl;
I do apologize in advance for something that could be so trivial. I have never worked with times and so forth. I also may have taken out other important aspects for the code to run as well.
Thank you for all the help and have a great day.