2-3 list2-8 逐个显示字符,再逐个消去

#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);
    }
  }
}
posted @   yuzuki_n  阅读(4)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
点击右上角即可分享
微信分享提示