#include <iostream>
#include <cstring>
#include <time.h>
#include <stdlib.h>
usingnamespace std;
int main()
{
char output[] = "Hello there world";
int len = strlen(output);
for (int i = 0; i < len; i++)
{
cout << output[i];
system("sleep 1");
}
return 0;
}
It sleeps the amount of time it would have taken to print out the whole line and then it prints out the whole sentence at once. I've tried the sleep() and usleep() as well, but with the same result.
This also works fine on windows but not in Linux.
Any ideas?