#include <StdAfx.h>
#include <stdio.h>
#include <time.h>
#include <conio.h>
#include <string.h>
#define TIME_INTERVAL (CLOCKS_PER_SEC / 50)
int main(int argc, char* argv[])
{
int i, j;
long c;
char str[80] = "Hello world!";
int l = strlen(str);
char sleft[80];
char sright[80];
int scrwidth = 79;
while (1)
{
for (i = 0; i <= scrwidth; i++)
{
if (i <= scrwidth - l)
{
c = clock();
for (j = 0; j < i; j++)
{
printf(" ");
}
printf("%s ", str);
while (clock() - c <= TIME_INTERVAL)
;
}
else
{
c = clock();
strcpy(sleft, str);
strcpy(sright, str + l - (i - (scrwidth - l)));
*(sleft + l - (i - (scrwidth - l))) = NULL;
for (j = 0; j < i; j++)
{
printf(" ");
}
printf("%s ", sleft);
printf("%s ", sright);
while (clock() - c <= TIME_INTERVAL)
;
}
}
}
return 0;
}
C语言实现滚动字幕
转载下一篇:虚拟机挂载U盘 命令
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
【数据结构】C语言实现顺序栈
【数据结构】第三章——栈、队列和数组详细介绍通过C语言实现顺序栈
数据结构 C语言 顺序栈 -
c语言实现阶乘
学习记录
#include i++ -
C语言实现timeconfig
这个示例代码使用C语言中的系统调用和标准库函数来实现timeconfig命令的功能。它接受一个时区参数作为命令行参数,并根据该参数进行相应的操作来修改系统的时区设置。
java linux 服务器 #include 字符串 -
C语言实现串
新建头文件str.h#ifndef _STR_H#define _STR_Htypedef struct _STR{ char* ch; int len;}STR;STR *NewStr(char* str);void DestroyStr(STR* s);
c语言 visual studio 开发语言 #include i++ -
C语言实现模版
C语言有两把双刃剑,一把是“指针”,另一把是“宏”。这回咱就用“宏”来实现C++中才有
C #define #include 预处理