Are you on Windows? You can use sleep function to delay text from appearing. Must use Windows API for it to work.
1 2 3 4 5 6 7 8
#include <windows.h>
int main()
{
// Sleep(number of milliseconds);
Sleep(5000); // 5 seconds
std::cout << "I love you" << std::endl;
}
If you compile with C++11, you can do this cross-platform. This is a better option*:
1 2 3 4 5 6 7 8 9
#include <thread>
#include <chrono>
#include <iostream>
int main()
{
std::this_thread::sleep_for(std::chrono::seconds(5));
std::cout << "I love you" << std::endl;
}
*(Chervil's answer is also perfectly good, it let's you control 2x threads asynchronously)
s.b I mean using c ++ standard library to write. Do not mention me with windows, that is an alternative. If you look at the windows kernel source code, you will feel how bad windows! Bug too much. I suggest you still use linux or like unix. After all, Unix and linux stability. If you do not think of my idea, that does not matter.