I want some random characters printed on the console and then deleted with "\b"
. After that, I want to put my own variable so that it looks like "randomization." The problem is that this is happening too fast. I wanted to delay the output with the function usleep
or sleep
, but when I use it, nothing is printed in the console.
A brief example:
#include <iostream>
#include <unistd.h>
using namespace std;
int main()
{
char chars[]={'a','b','c','g','h','u','p','e','y'};
for(int i=0; i<8; i++)
{
cout << chars[i];
usleep(200000);
cout << "\b";
}
}
source
share