Assuming the vector has 5 elements:
#include <chrono>
#include <thread> /* introduced with c++11,
make sure your compiler is up to date
and is set to compile c++ with this version
of the STL and standard
*/
for (int i = 0; i < count; ++i)
{
cout << vector[count] << endl;
std::this_thread::sleep_for(std::chrono::seconds(1));
}
You can also use Sleep(n)
from <windows.h>
alternatively.
4
solved Iteration vector 5 in 5 seconds c [closed]