【#文档大全网# 导语】以下是®文档大全网的小编为您整理的《C语言实现滚动字幕》,欢迎阅读!
![字幕,滚动,语言,实现](/static/wddqxz/img/rand/big_130.jpg)
.
C语言实现滚动字幕
#include
#include #include #include #include
#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++) ...{
1 / 2'.
.
printf(" "); }
printf("%s ", sleft); printf("%s ", sright);
while (clock() - c <= TIME_INTERVAL) ; } } }
return 0; }
2 / 2'.
本文来源:https://www.wddqxz.cn/a4e6e540ac1ffc4ffe4733687e21af45b207fe5b.html