首页 > 其他 > 详细

输出字符串,以及使用退格删除字符串

时间:2019-06-17 00:50:07      阅读:255      评论:0      收藏:0      [点我收藏+]

 

#include <time.h>
#include <stdio.h>
#include <string.h>

int sleep(unsigned long x)
{
    clock_t c1 = clock(), c2;
    do {
        if ((c2 = clock()) == (clock_t)-1)    
            return 0;
    } while (1000.0 * (c2 - c1) / CLOCKS_PER_SEC < x);
    return 1;
}

int main(void)
{
    int  i;
    char name[] = "BohYoh Shibata";            
    int  name_len = strlen(name);            
    while (1) {        
        for (i = 0; i < name_len; i++) {    
            putchar(name[i]);
            fflush(stdout);
            sleep(500);
        }
        for (i = 0; i < name_len; i++) {    
            printf("\b \b");
            fflush(stdout);
            sleep(500);
        }
    }
    return 0;
}

 

输出字符串,以及使用退格删除字符串

原文:https://www.cnblogs.com/sea-stream/p/11037579.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!