C语言实现从左向右字幕滚动的效果

#include <stdio.h> #include <string.h> #include <windows.h> int main() { char str[100] = "HELLO WORLD! GOOD BYE!"; int i,j; while(1) { for(i=0;i<strlen(str);i++) { system("cls"); for(j=i;j<strlen(str);j++) { printf("%c",str[j]); } Sleep(100); printf("\n"); } } return 0; }
system("CLS") 是在C语言程序中,调用系统命令cls完成清屏操做。 system("time /t") ;显示时间 system("dir"); //列目录 system("pause");来实现驻留。

system函数是C语言提供的与操做系统衔接的函数,函数原型以下:shell

#include <stdlib.h> //所在头文件 int system(const char *command); //参数为操做系统命令 函数功能:execute a shell command 执行一个操做系统命令  
相关文章
相关标签/搜索