C++ timer important help! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C++ timer important help!

Guys can you tell me what is the code from which our code will take take according how we set that code to output: For ex: like my code is cout<<"sololearn is cool"; So i want this code will output 2second later so from which code we can do this?? Thanks, Alz_47 Yt

22nd Aug 2022, 2:08 PM
Alz_47 YT
Alz_47 YT - avatar
2 Answers
+ 1
You can use the sleep_for() method from the standard library: https://en.cppreference.com/w/cpp/thread/sleep_for
22nd Aug 2022, 10:57 PM
Shadow
Shadow - avatar
+ 1
in java i do it by multi threading I'm not sure about C++. if C++ supports threads then you can do it.
22nd Aug 2022, 2:14 PM
Davinder Kumar
Davinder Kumar - avatar