I am trying to do a very simply thing (yet spent hours without a result): Print one line, sleep a little, print a second line. I expect the below code to do that, however, it first sleeps then prints both lines simultaneously! Can anyone see what I'm missing here?
This is the entire code:
#include<thread>
#include<chrono>
int main() {
printf("%s","Wait.\n");
std::this_thread::sleep_for(std::chrono::seconds(3));
printf("%s","Thank you for waiting.");
}
Computer info: Mac 10.14.16, Editor: CLion