#include <stdio.h>
#include <time.h>
#include <string.h>
// 等待x毫秒
int sleep(unsigned long x)
{
clock_t c1 = clock(), c2;
do {
if ((c2 = clock()) == (clock_t) -1)
return 0;
} while ((c2 - c1) < x);
return 1;
}
int main()
{
int i;
char name[] = "BohYoh Shibata";
int name_len = strlen(name);
while (1)
{
for (int i = 0; i < name_len; i++)
{
putchar(name[i]);
fflush(stdout);
sleep(500);
}
for (int i = 0; i < name_len; i++) {
printf("\b \b");
fflush(stdout);
sleep(500);
}
}
}
标签:name,clock,int,显示字符,len,list2,sleep,逐个
From: https://www.cnblogs.com/yuzuki/p/17612919.html