Delay function equivalent in C++

Thanks for the answer.
I updated the post. Check it out!