首页 > 其他分享 >2-3 list2-8 逐个显示字符,再逐个消去

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

时间:2023-08-07 22:33:50浏览次数:39  
标签:name clock int 显示字符 len list2 sleep 逐个

#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

相关文章

  • C# winform 实现逐个显示文字
    如题,可以使用timer控件来实现,可以通过设置timer控件属性中的Interval来设置时间间隔(使用VS2019)usingSystem;usingSystem.Diagnostics;usingSystem.Windows.Forms;namespaceTest{publicpartialclassForm3:Form{privateconststringflash="逐个......
  • vue列表逐个进入过渡动画
    vue列表逐个进入过渡动画vue2,vue3,通过vfor产生列表,使子元素逐个进入效果文章详情:https://www.cnblogs.com/Llshy/articles/17430695.html......
  • 考研英语不熟悉的词义(List21)
    目录考研英语不熟悉的词义(List21)List21(56个)考研英语不熟悉的词义(List21)List21(56个)单词不熟悉的词义grown-upa.成年的n.大人handbookn.手册platformn.纲领landlordn.房东,地主overwhelmvt.击败,淹没rallyn.集会v.集合swarmn.一大群vi.挤满......
  • 高亮显示字符。兼容大小写,特殊字符
    一个兼容大小写,特殊字符的高亮显示函数functionhighlight(str,char){constescapedChar=char.replace(/[.*+?^${}()|[\]\\]/g,'\\$&');if(str.toLowerCase().includes(char.toLowerCase())){returnstr.replace(newRegExp(escapedChar,'gi'......
  • C程序使用循环从A到Z显示字符
    以下是一个简单的C程序,使用循环从A到Z显示字符:cCopycode#include<stdio.h>intmain(){charch='A';while(ch<='Z'){printf("%c",ch);ch++;}printf("\n");return0;}这个程序初始化一个......
  • vuejs实现文字逐个显示效果且可以换行
    实现方式:开始文字设置为空,然后通过添加定时器截取content字符串来实现。效果展示如下:具体实现如下:<template><div><divv-html=“showText ”></div></div></template><script>exportdefault{data(){return{......
  • 字符串的逐个输出(java)
    import java.util.Scanner;public class Ward{public static void main(String[]args){Scannerinput =new Scanner(System.in);Stringstr =input.next......
  • LQB05 数码管动态扫描,显示字符串
    1、蓝桥杯51单片机开发板的数码管是共阳数码管;需要注意段码表的推导。掌握推导段码表。2、stcisp软件的数码管代码,是共阴的模式,注意取反的话,如何实现?3、定时器动态扫描......
  • 0x05_My-OS显示字符串和任意参数
    先看看效果: 要解决两个问题,第一个如何显示字符串,printf?我之前已经说了所有的头文件都要自己写,printf是stdio里的可是我们没有stdio我们要通过画像素点的方式显示字符......
  • 在开发板上显示字符和中文
    我们在写lcd驱动程序时,测试时可以在lcd上显示信息,那么他怎么能显示出信息呢,内核里有字符点阵编码,我们在内核里打开字符编码,可以看到很多字符点阵也称为字体。下面我们来自......