I am using a chrono to get the time elapsed during a loop. I would like to display this time every loop run.
I can do this:
for(int i = 0;i<3;i++)
{
sleep(2 secs);
time= get_time();
cout<<"time is : "<<time;
}
But I have the output:
time is : 2 time is : 4 time is : 6
I could add an endl
to have it in column but that is not what I want. My loop is about million times, so I don't really want to print a million lines.
I would just like to print like:
time is : 2
and then refresh it to
time is : 4
and so on. Is there a way to do this?