This is the code that I got but it has some errors and not running. Also i want to use <chrono>, which people say is advance but i have no clue as to how we will use it? Can you help me??
The C library clock() function only has a second resolution. You'll need an OS-specific function to get a finer resolution. Even then, though, you typically need to repeat a subroutine a good number of times to get a good idea of how long it takes a subroutine to complete. For user inputs, which I think you want here, see http://www.cplusplus.com/forum/beginner/28855/3/#msg159698 for an example of doing the same thing.
I suggest you get a couple of chrono::time_point <chrono::high_resolution_clock>s and use a chrono::duration object to calculate the time difference in your preferred units.
> The C library clock() function only has a second resolution.
The C library clock() function has an implementation defined CLOCKS_PER_SEC resolution. clock() measures the approximate processor time used, and not the elapsed time.